
$(document).ready(function(){ 
	//prepinani pravych banneru b1,b2,b3
	$(".home-action:visible").hide();
	$(".home-action:eq(0)").show();	
    
    $(".b1").click(function () { 
      	$(".home-action:visible").hide();
		$(".home-action:eq(0)").fadeIn(1000);
		return false;
    });
     $(".b2").click(function () { 
      	$(".home-action:visible").hide();
		$(".home-action:eq(1)").fadeIn(1000);
		return false;
    });
     $(".b3").click(function () { 
      	$(".home-action:visible").hide();
		$(".home-action:eq(2)").fadeIn(1000);
		return false;
    });
    
    //prepinani pravych sipek u banneru b1,b2,b3
    $("#banners a").click(function () {
		$("#banners a span").remove(); 
      	$(this).append("<span></span>")
		return false;
    });
    
     

  });
  
$(document).ready(function(){// poptavkovy formular
	$(".optional-content").hide();
	$(".tr1").show();
	$(".tr4").show();
	
	$(".tr1-input").click(function () {
    		if ($(".tr1-input").is(":checked")) {$(".tr1").show();}
       		else {$(".tr1").hide();}       			
        })
    $(".tr2-input").click(function () {
    		if ($(".tr2-input").is(":checked")) {$(".tr2").show();}
       		else {$(".tr2").hide();}       			
        }) 
	$(".tr3-input").click(function () {
    		if ($(".tr3-input").is(":checked")) {$(".tr3").show();}
       		else {$(".tr3").hide();}       			
        }) 
	$(".tr4-input").click(function () {
    		if ($(".tr4-input").is(":checked")) {$(".tr4").show();}
       		else {$(".tr4").hide();}       			
        })	
	$(".tr5-input").click(function () {
    		if ($(".tr5-input").is(":checked")) {$(".tr5").show();}
       		else {$(".tr5").hide();}       			
        })	
	$(".tr6-input").click(function () {
    		if ($(".tr6-input").is(":checked")) {$(".tr6").show();}
       		else {$(".tr6").hide();}       			
        })
	$(".tr7-input").click(function () {
    		if ($(".tr7-input").is(":checked")) {$(".tr7").show();}
       		else {$(".tr7").hide();}       			
        })			   

	//prepinani pravych sipek u banneru b1,b2,b3
	$(".table-text:eq(0) tr").slice(4,16).hide();
	$(".table-text:eq(1) tr").slice(4,16).hide();
	$(".table-text:eq(2) tr").slice(4,16).hide();
	$(".table-text:eq(3) tr").slice(4,16).hide();
	$(".table-text:eq(4) tr").slice(4,16).hide();

	$(".table-text").after("<a href='#' class='next'>další řádek</a><br /><br />");
    $(".next").click(function () {
    	var index = $(".next").index(this);
    	$(".table-text").eq(index).find("tr:hidden:eq(0)").show();
		return false;	
    });

	// zabezpeceni proti robotum //
	
	$("input.verify").val('verified');
    

  });  

// JavaScript Document
$(document).ready(function(){
    $(".banner1").hover(function(){$(this).addClass("banner1-hover");},
		function(){$(this).removeClass("banner1-hover");});
	$(".banner2").hover(function(){$(this).addClass("banner2-hover");},
		function(){$(this).removeClass("banner2-hover");});
	$(".banner3").hover(function(){$(this).addClass("banner3-hover");},
		function(){$(this).removeClass("banner3-hover");});
	$(".banner4").hover(function(){$(this).addClass("banner4-hover");},
		function(){$(this).removeClass("banner4-hover");});
	$(".banner5").hover(function(){$(this).addClass("banner5-hover");},
		function(){$(this).removeClass("banner5-hover");});
	$(".banner6").hover(function(){$(this).addClass("banner6-hover");},
		function(){$(this).removeClass("banner6-hover");
	 });
	 
	 
	$("li .question-mark").hover(function(){
	 	 $(this).parent("label").parent("span").addClass("question-index");	 	
	 	},
	 	function(){
		 $(this).parents("span").removeClass("question-index");		 
		 });
		 
	$("th .question-mark").hover(function(){
	 	 $(this).parent("th").addClass("question-index");	 	
	 	},
	 	function(){
		 $(this).parent("th").removeClass("question-index");		 
		 });
		 
	$(".optional-content ul").hover(function(){
	 	 $(this).addClass("ul-hover");	 	
	 	},
	 	function(){
		 $(this).removeClass("ul-hover");		 
		 });
		 
	 /*reference*/
	 $(".galery-ref-box").hover(function(){
	   $(this).addClass("galery-ref-box-hover");
	 },function(){
	   $(this).removeClass("galery-ref-box-hover");
	 });
	 
	/*toggle text index*/
 	$(".toggle-text-hide").hide();
	$("#toggle-manage").click(function () {
		$(".toggle-text-hide").slideToggle("slow");
		$("#toggle-manage").toggleClass("toggle-manage-hover");
	});
	
//form
	$(".verify").attr("value","verified");
	
	$(".contact-form1").bind('submit',function(){
			
		
		var insert_post = $(this).serialize(); //metoda serialize vytvoří post z aktuálního formuláře
		insert_post += '&submitted=1'; //kpostu přilepím potvrzovací hodnotu
		$.post($(this).attr('action'),insert_post, function(data) { // Ajax volá url které je jako ACTION ve FORMU a vrací data
		
			
			var jdata = eval("(" + data + ")");
				
			if (jdata.status == 'true'){//vykonají se funkce dle návratových dat
				window.location.href=jdata.url;
				
			}
			else{
				window.location.href='#top';
				$('.error_message').attr('style','');
				
				if(jdata.error1 == 'true') $('.tname').addClass('error');
				else $('.tname').removeClass('error');
				if(jdata.error2 == 'true') $('.tmail').addClass('error');
				else $('.tmail').removeClass('error');
				if(jdata.error3 == 'true') $('.tplace').addClass('error');
				else $('.tplace').removeClass('error');
			};
		});
		return false;
	});	
	
  
	
	$(".tr4-input").attr("checked", "checked");
	
});

