var regEx_email = /^[\ a-z0-9._-]+@[a-z0-9.-]+\.[a-z]{2,6}$/i;

$(document).ready(function() {
	
	$().piroBox({
		  my_speed: 400, //animation speed
		  bg_alpha: 0.9, //background opacity
		  slideShow : true, // true == slideshow on, false == slideshow off
		  slideSpeed : 3, //slideshow
		  close_all : '.piro_close, .piro_overlay' // add class .piro_overlay(with comma)if you want overlay click close piroBox
	});


	//Invoking the supersized function on the div with id - supersize. It is the div that contains the large background image	
	if(( $.browser.msie ) && ( $.browser.version == 6 )) 
	{
		
	}
	else
	{
		var bgUrl = $("body").css("background-image");
		//url pro chrome a safari
		bgUrlChrom_Safari = bgUrl.substring( 4, bgUrl.length - 1 );
		
		//url pro ostatni
		bgUrl_Ostatni = bgUrl.substring( 5, bgUrl.length - 2 );
		
		if(( $.browser.msie ) || ( $.browser.mozilla )) 
		{
			$.backstretch(bgUrl_Ostatni, {speed: 0});
		}
		else
		{
			$.backstretch(bgUrlChrom_Safari, {speed: 0});
		}
		
		//$.backstretch("/img/bg-all.jpg", {speed: 500});
	}

	$("#ie-check").ie6warning();	
	
//	$(".slidetabs").tabs(".rotate-index > div", {
//	
//			// enable "cross-fading" effect
//			effect: 'fade',
//			fadeOutSpeed: 1000,
//			fadeInSpeed: 1000,
//		
//			// start from the beginning after the last tab
//			rotate: true
//			
//		// use the slideshow plugin. It accepts its own configuration
//		}).slideshow(
//		{
//			autoplay: true,
//			interval: 10000
//		}
//	);
	


	// FAQ // FAQ // FAQ
	
	$(".faq-full").toggle(
		function () 
				{ 
					$("p", this).show({duration:300,queue:false});
					$(".faq-otazka", this).animate({ "font-size" : "14px" });
				},
				
		function () 
				{ 
					$("p", this).hide({duration:300,queue:false});
					$(".faq-otazka", this).animate({ "font-size" : "18px" });
				}
	);
	
	// objednat
	$("#objednat").click( function()
		{
			$("#objednat").hide(0);
			$(".detail-box-grey").hide(0);
			$("#objednat-wrapper").show(0);
		}
	);
	
	$("#objednat-form-submit").click( function()
		{
			var jmeno = $('#objednat-form [name=name]').val();
			if ( jmeno == '' )
			{
				alert( 'Zadejte Vaše jméno a příjmení.' );
				return false;
			}
			
			var email = $('#objednat-form [name=email]').val();
			if ( email == '' )
			{
				alert( 'Zadejte e-mail.' );
				return false;
			}
			else
			{
				if ( regEx_email.test( email ) == false )
				{
					alert( 'Zadejte spravný e-mail.' );
					return false;
				}
			}					
			
			var text = $('#objednat-form [name=text]').val();
			if ( text == '' )
			{
				alert( 'Zadejte znění objednávky.' );
				return false;
			}
			
			var dvacetdva = $('#objednat-form [name=dvacetdva]').val();
			if ( dvacetdva != '22' )
			{
				alert( 'Napište číslicemi "dvacetdva".' );
				return false;
			}
		}
	);
}
);



