$(document).ready(function(){

	if ($('a[rel*=lightbox]').length){
		$(function() {
			$('a[rel*=lightbox]').lightBox({
				imageBtnPrev: '/javascript/lightbox/images/lightbox-btn-prev.gif',	
				imageBtnNext: '/javascript/lightbox/images/lightbox-btn-next.gif',
				imageBtnClose:'/javascript/lightbox/images/lightbox-btn-close.gif',
				imageLoading: '/javascript/lightbox/images/lightbox-ico-loading.gif'
			});
		});
	}
	
	if ($("#username").length){
		if ($("#username").length){
			$("#username").watermark('Felhasználónév');
			$("#password").watermark('Jelszó');
		}	
		
		if ( $('#InvoicingName').val()!='' || $('#InvoicingCity').val()!='' || $('#InvoicingPostcode').val()!='' || $('#InvoicingArddess').val()!='' ){
			$('.billingAddress').show();
			$('#billingCheck').attr('checked','checked');
		} else {
			$('.billingAddress').hide();
			$('#billingCheck').attr('checked','');
		}
		
		if ($('#billingCheck')){
			$('#billingCheck').bind('click', function(){
			    if ($('#billingCheck').attr('checked').toString() == 'true')
			    	$('.billingAddress').slideDown();
			    else
			    	$('.billingAddress').slideUp();
			});
		}
	}
	if ($('#error-message').length){
		$("#error-message").dialog({
			draggable: false,
			width: 400,
			resizable: false,
			modal: true,
			dialogClass: 'alert',
			title: 'FIGYELEM',
			buttons: { "Rendben": function() { $(this).dialog("close"); } }
			
		});
	}
	
	if ($('#dialog').length){
		$("#dialog").dialog({
			draggable: false,
			height: 70,
			width: 400,
			resizable: false,
			modal: true,
			dialogClass: 'alert'
			
		});
		$(".ui-dialog-titlebar").hide();
		setTimeout("closeDialog()",2000);
	}
	
	if ($('.banner').length){
		$('.banner').bind('click',function(){
			this.select();
		})
		
	}

	if ($('.delprod').length){
		$('.delprod').bind('click', function(){
		    if ($(this).attr('checked').toString() == 'true')
		        if (confirm("Biztos, hogy törölni akarja?")) 
		        	$('#kosar').submit();
		        else
		        	$(this).attr('checked','');
		});
	}
	
});
function closeDialog(){
	$('#dialog').dialog("close")
}
