	$(document).ready(function() {
		
		//Fireup lightbox
		//Setup The lightBox
		$('#pictures a').lightBox();
		$('.lightBox').lightBox();
		
		//hide the scrollbars on the slideshow
		$("#bigBanner ul#slides").css("overflow", "hidden");
		
		// Enables the slideshow
		$("ul#slides").cycle({
			fx: 'fade',
			pause: 1,
			prev: '#prev',
			next: '#next'
		});	
		
	$("#bigBanner").hover(function() {
		$("ul#nav").fadeIn();
		},
		function() {
		$("ul#nav").fadeOut();
		}
	);		

	//product show/hide stock
	$(".product").hover(function() {
		$(this).find(".stock").fadeIn();
		},
		function() {
		$(this).find(".stock").fadeOut();
		}
	);	


	$(".shipping_note").hide();

	$("#shipping_methods ul li").hover(function() {
			$(this).find('.shipping_note').fadeIn();
		},
		function() {
			$(this).find('.shipping_note').fadeOut();
		}
	);	

	$("#menu").hide();

	$("#eshopLink, #menu").hover(function() {
			$("#menu").show();
		},
		function() {
			$("#menu").hide();
		}
	);	


	$("#odber").hover(function() {
			$("#postFeeInfo").fadeIn();
		},
		function() {
			$("#postFeeInfo").fadeOut();
		}
	);	
	
	
	
	//init tabs
	$("#tabs").tabs();

	//loadFacebook Friends
	//$('#fb_content').load('/facebook.php');

	$('ul#basketItems').hide();

	$('#add_to_basket_bt').click(function() { 

		$('html, body').animate({scrollTop:0},'slow');
			
		$('#basket').html("<div id=\"loader\"><img src=\"/images/loader.gif\"></div>");


		amount = $('#amount').val();
		product = $('#prId').val();

		$.ajax({
			   type: 	"GET",
			   url: 	"/basket.php",
			   data:	"basket=add&prid="+product+"&amount="+amount,
			   success: function(msg){
						$('#basketBox').html(msg);
						$('ul#basketItems').hide();
			   }
		});
	}) //click



//on load

		$("#mail_send").click(function(){
			
			error = 0;
			
			// vycistime vsechny errory
			$('#mail_email_chk').html("");
			$('#mail_name_chk').html("");
			$('#mail_surname_chk').html("");
			$('#mail_query_chk').html("");
						
			
			name = $("#mail_name").val();
			surname = $("#mail_surname").val();
			company = $("#mail_company").val();
			email = $("#mail_email").val();
			phone = $("#mail_phone").val();			
			query = $("#mail_query").val();			

			mail_ptrn = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
			name_ptrn = /^[a-zA-ZěščřžýáíéůťďňĚŠČŘŽÝÁÍÉŮŤĎŇ ]+$/;
			surname_ptrn = /^[a-zA-ZěščřžýáíéůťďňĚŠČŘŽÝÁÍÉŮŤĎŇ ]+$/;
			query_ptrn = /^(.*)$/;

			
			if ( !mail_ptrn.test(email) ) {
				error = 1;
				$("#mail_email_chk").html("<img src=\'/images/sys/error.png\' style=\'margin:0px 0px 0px 4px\'/>");
			}

			 if ( !name_ptrn.test(name) ) {
				error = 1;
				$("#mail_name_chk").html("<img src=\'/images/sys/error.png\' style=\'margin:0px 0px 0px 4px\'/>");
			}

			
			if ( !surname_ptrn.test(surname) ) {
				error = 1;
				$("#mail_surname_chk").html("<img src=\'/images/sys/error.png\' style=\'margin:0px 0px 0px 4px\'/>");
			}

			
			if ( query.length == 0) {
			//if ( !query_ptrn.test(query) ) {
				error = 1;
				$("#mail_query_chk").html("<img src=\'/images/sys/error.png\' style=\'margin:0px 0px 0px 4px\'/>");
			}
			
			if (error == 0) {
				$("#sendMessage").append('<img src=\'/images/loader.gif\' style=\'margin-top:14px; margin-left:15px;\'/>'); //.animate({height: '80px'},1200);
			
			values = "names="+name+"&surnames="+surname+"&companys="+company+"&emails="+email+"&phones="+phone+"&querys="+query;
			
			$.ajax({
					url : "/mail.php",
					type: "POST",
					data: values,
					success : function (msg) {$("#mail_progress").html(msg).slideDown()}
			});
		}			
		return false;
		}); //send mail


});





function checkForm() {
	var radio_choice = false;
	var license = false;
	if ( document.typ_dopravy.shipping[0].checked ) radio_choice = true;
	if ( document.typ_dopravy.shipping[1].checked ) radio_choice = true;
	if ( document.typ_dopravy.shipping[2].checked ) radio_choice = true;
	
	if ( radio_choice == false ) {
		alert("Vyberte prosim způsob dopravy a platby");
		return radio_choice;
	}
	
	if (document.getElementById('license').checked) license = true;

	if ( license == false ) {
		alert("Musíte souhlasit se všeobecními podminkami");
	}
		return license;	
}

