function hideall(){
	 $("#onas").hide();
	 $("#onas_x").hide();
     $("#festival").hide();
     $("#festival_x").hide();
     $("#odkazy").hide();
     $("#odkazy_x").hide();
     $("#galerie").hide();
     $("#galerie_x").hide();
     $("#historie").hide();
     $("#historie_x").hide();
     $("#guestbook").hide();
     $("#guestbook_x").hide();
     $("#kontakty").hide();
     $("#kontakty_x").hide();
     $("#klub").hide();
     $("#klub_x").hide();
     $("#sponzori").hide();
     $("#sponzori_x").hide();
     $("#next").hide();
     $("#close").hide();
};

function load_all(){
	$("#onas").show().load("templates.php?img=onas");
    $("#festival").show().load("templates.php?img=festival");
    $("#odkazy").show().load("templates.php?img=odkazy");
    $("#galerie").show().load("templates.php?img=galerie");
    $("#historie").show().load("templates.php?img=historie");
    $("#guestbook").show().load("templates.php?img=guestbook");
    $("#kontakty").show().load("templates.php?img=kontakty");
    $("#klub").show().load("templates.php?img=klub");
    $("#sponzori").show().load("templates.php?print=sponzori");
    $("#next").show();

};



$(document).ready(function(){
	$("#close").hide();
	$("#sponzori").show().load("templates.php?print=sponzori");
	$("#next").click(function(){
		hideall();
		$("#sponzori").hide();
		$("#sponzori_x").css({'background-color':'black'});
		$("#sponzori_x").animate({width: "800px",height: "600px"}, 500 );
		$("#sponzori_x").load("templates.php?print=sponzori_x");
		//$("#close").show();
	});

	$("#close").click(function(){
		hideall();
	    load_all();
	});
	$("#klub").click(function(){  
			hideall();
			$("#klub_x").css({'background-color':'#0070b5'});
			$("#klub_x").css({'overflow':'auto'});
			$("#klub_x").animate({width: "800px",height: "600px"}, 1 );
			$("#klub_x").load("templates.php?print=program");
			$("#sponzori").show().load("templates.php?print=sponzori");
			$("#next").show();
			$("#close").show();
			
	});
	$("#festival").click(function(){
		hideall();
		$("#festival_x").css({'overflow':'auto'});
		$("#festival_x").css({'background-color':'#E2090D'});
		$("#festival_x").animate({width:"800px",height:"600px",top:"60px"},500);
		$("#festival_x").load("templates.php?print=festival");
		$("#sponzori").show().load("templates.php?print=sponzori");
		$("#next").show();
		$("#close").show();
	});
	$("#onas").click(function(){
		hideall();
		$("#onas_x").animate({width:"800px",height:"600px",top:"60px"},500);
		//$("#onas_x").css({'overflow':'none'});
		$("#onas_x").css({'background-color':'#FE9500'});
		$("#onas_x").load("templates.php?print=about");
		$("#sponzori").show().load("templates.php?print=sponzori");
		$("#next").show();
		$("#close").show();
	
	});
	$("#odkazy").click(function(){
		hideall();
		$("#odkazy_x").animate({width:"800px",height:"600px",top:"60px"},500);
		//$("#odkazy_x").css({'overflow':'none'});
		$("#odkazy_x").css({'background-color':'#008B2F'});
		$("#odkazy_x").load("templates.php?print=links");
		$("#sponzori").show().load("templates.php?print=sponzori");
		$("#next").show();
		$("#close").show();
		
	});
	$("#galerie").click(function(){
		hideall();
		$("#galerie_x").animate({width:"800px",height:"600px",top:"60px"},1);
		//$("#galerie_x").css({'overflow':'none'});
		$("#galerie_x").css({'background-color':'#0071BB'});
		$("#galerie_x").load("templates.php?print=galerie");
		$("#gal a").lightBox();
		$("#sponzori").show().load("templates.php?print=sponzori");
		$("#next").show();
		$("#close").show();
		
	});
	$("#historie").click(function(){
		hideall();
		$("#historie_x").animate({width:"800px",height:"600px",top:"60px"},500);
		$("#historie_x").css({'background-color':'#F0000B'});
		$("#sponzori").show().load("templates.php?print=sponzori");
		$("#next").show();
		$("#close").show();
		
		$("#historie_x").load("templates.php?print=historie", function(){

			$("#1998").click(function(){
				$("#right").load("templates.php?print=rok&rok=1998");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #1998").css({'background-color':'#F0000B'});
			});
			$("#1999").click(function(){
				$("#right").load("templates.php?print=rok&rok=1999");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #1999").css({'background-color':'#F0000B'});
			});
			$("#2000").click(function(){
				$("#right").load("templates.php?print=rok&rok=2000");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2000").css({'background-color':'#F0000B'});
			});
			$("#2001").click(function(){
				$("#right").load("templates.php?print=rok&rok=2001");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2001").css({'background-color':'#F0000B'});
			});
			$("#2002").click(function(){
				$("#right").load("templates.php?print=rok&rok=2002");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2002").css({'background-color':'#F0000B'});
			});
			$("#2003").click(function(){
				$("#right").load("templates.php?print=rok&rok=2003");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2003").css({'background-color':'#F0000B'});
			});
			$("#2004").click(function(){
				$("#right").load("templates.php?print=rok&rok=2004");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2004").css({'background-color':'#F0000B'});
			});
			$("#2005").click(function(){
				$("#right").load("templates.php?print=rok&rok=2005");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2005").css({'background-color':'#F0000B'});
			});
			$("#2006").click(function(){
				$("#right").load("templates.php?print=rok&rok=2006");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2006").css({'background-color':'#F0000B'});
			});
			$("#2007").click(function(){
				$("#right").load("templates.php?print=rok&rok=2007");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2007").css({'background-color':'#F0000B'});
			});
			$("#2008").click(function(){
				$("#right").load("templates.php?print=rok&rok=2008");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2008").css({'background-color':'#F0000B'});
			});
			$("#2009").click(function(){
				$("#right").load("templates.php?print=rok&rok=2009");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2009").css({'background-color':'#F0000B'});
			});
			$("#2010").click(function(){
				$("#right").load("templates.php?print=rok&rok=2010");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2010").css({'background-color':'#F0000B'});
			});
			$("#2011").click(function(){
				$("#right").load("templates.php?print=rok&rok=2011");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2011").css({'background-color':'#F0000B'});
			});
			$("#2012").click(function(){
				$("#right").load("templates.php?print=rok&rok=2012");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2012").css({'background-color':'#F0000B'});
			});
			$("#2013").click(function(){
				$("#right").load("templates.php?print=rok&rok=2013");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2013").css({'background-color':'#F0000B'});
			});
			$("#2014").click(function(){
				$("#right").load("templates.php?print=rok&rok=2014");
				$("#left div").css({'background-color':'#0071BB'});
				$("#left #2014").css({'background-color':'#F0000B'});
			});

			});
		
		});
		
	
		
	$("#guestbook").click(function(){
		hideall();
		
		$("#guestbook_x").animate({width:"800px",height:"600px",top:"60px"},500);
		$("#guestbook_x").css({'background-color':'#F98400'});
		$("#sponzori").show().load("templates.php?print=sponzori");
		$("#next").show();
		$("#close").show();
		$("#guestbook_x").load("templates.php?print=guestbook" , function(){

			$("#send").click(function(){
				var hasError = false;
				var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

				var emailVal = $("#email").val();
				if(emailVal == '') {
					$("#email").css({'background-color':'red'});
					hasError = true;
				} else if(!emailReg.test(emailVal)) {
					$("#email").css({'background-color':'red'});
					hasError = true;
				} else if(emailVal=='my@email.com') {
					$("#email").css({'background-color':'red'});
					hasError = true;
				} else if(emailVal=='muj@email.cz') {
					$("#email").css({'background-color':'red'});
					hasError = true;
				}else $("#email").css({'background-color':'#E8B40C'});

				var jmenoVal = $("#jmeno").val();
				if(jmenoVal == '') {
					$("#jmeno").css({'background-color':'red'});
					hasError = true;
				}else if (jmenoVal == 'moje jmeno') {
					$("#jmeno").css({'background-color':'red'});
					hasError = true;
				}else $("#jmeno").css({'background-color':'#E8B40C'});

				
				
	
				var hlodVal = $("#textarea").val();
				if(hlodVal == '') {
					$("#textarea").css({'background-color':'red'});
					hasError = true;
				}else if(hlodVal == 'muj novy prispevek') {
					$("#textarea").css({'background-color':'red'});
					hasError = true;
				}else $("#textarea").css({'background-color':'#E8B40C'});

				//return false;
				if(hasError==false){
					$.post("guestbook.php",{ jmeno: jmenoVal, email: emailVal, hlod: hlodVal }, function(data){
					
						$("#email").css({'background-color':'#E8B40C'}).val("@");
						$("#jmeno").css({'background-color':'#E8B40C'}).val("name");
						$("#textarea").css({'background-color':'#E8B40C'}).val("text");
						//$("#guestbook_vypis").html("kuk");
						$("#guestbook_vypis").load("templates.php?print=hlody");
					
					});
				}
				
			
			});
		});
	});
			
	$("#kontakty").click(function(){
		hideall();
		
		$("#kontakty_x").animate({width:"800px",height:"600px",top:"60px"},500);
		$("#kontakty_x").load("templates.php?print=kontakt");
		$("#kontakty_x").css({'background-color':'#008B2F'});
		$("#sponzori").show().load("templates.php?print=sponzori");
		$("#next").show();
		$("#close").show();
	});
	
	$("#logo").click(function(){
		
		
		hideall();
	    
		
		$("#onas").show().load("templates.php?img=onas");
	    $("#festival").show().load("templates.php?img=festival");
	    $("#odkazy").show().load("templates.php?img=odkazy");
	    $("#galerie").show().load("templates.php?img=galerie");
	    $("#historie").show().load("templates.php?img=historie");
	    $("#guestbook").show().load("templates.php?img=guestbook");
	    $("#kontakty").show().load("templates.php?img=kontakty");
	    $("#klub").show().load("templates.php?img=klub");
	    $("#sponzori").show().load("templates.php?print=sponzori");
	    $("#next").show();
	
	});
	
	
});
