$(document).ready(function() {
						   
delay = 0; // beim ersten Klicken soll kein delay
toppos = 0; // Position des Content-fesnters vom oberen Rand
trans = 0.90; // Transparenzwert der Fenster



// Fenster verstecken ausser Kontaktshow-Variable /  ist gesetzt (z.b. Bei error-messages im Formular)
$('.content').not('.kontaktshow, .rueckshow').hide().animate({top: 400}, delay);
$('#kontakt.kontaktshow').css({opacity: trans});

// Fenster wieder auf left 0 setzen, Overriden der "Noscript"-Variante (href entfernen der Ankernavigation)
$('.content').css("left","0px");
$('#nav a, .impr, .button').removeAttr("href");


$('.part2, .part2 ul li').hide();
$('.mehr').click(function() {
						  $(this).parent('.part1').fadeOut(500);
						  $('.part2, .part2 ul li').animate({opacity: 1.0}, 500).fadeIn(500);
						  
						  });


$('.back').click(function() {
						  $(this).parent('.part2').fadeOut(500);
						  $(this).parent('.part2').siblings('.part1, .part1 ul li').animate({opacity: 1.0}, 500).fadeIn(500);
						  
						  });


						  


// SLideshow Rotation powered by Jquery Cycle PLugin
$('.slideshow').cycle({
				timeout: 3500 });




// Navipunkt aktiv bei Klick
$('ul#nav a').click(function() {
							 $('.active').removeClass("active").removeAttr("class");
							 $(this).addClass("active");
							 $('.part2, .part2 ul li').hide();
							 $('.part1, .part1 ul li').show();
							 
							 
							 });




$('a.impr').click(function() {
							 $('.active').removeClass("active").removeAttr("class");
							 $('a#nav_impressum').addClass("active");
							 });


// Kontakt-Klick
$('li#nav_kontakt a').click(function() {
					
					$('div.content').not('div#kontakt').animate({top: 400}, delay, 
														 function() { 														 
														 	$('div#kontakt').show().animate({top: toppos}, 500 ).css({opacity: trans});
															delay=500;
														});
					
});






// Idee-Klick
$('li#nav_idee a').click(function() {
					
					
					$('div.content').not('div#idee').animate({top: 400}, delay, 
														 function() { 														 
														 	$('div#idee').show().animate({top: toppos}, 500 ).css({opacity: trans});
															delay=500;
														});
					
});


// Zutaten-Klick
$('li#nav_zutaten a').click(function() {
					
					
					$('div.content').not('div#zutaten').animate({top: 400}, delay, 
														 function() { 														 
														 	$('div#zutaten').show().animate({top: toppos}, 500 ).css({opacity: trans});
															delay=500;
														});
					
});


// koeche-Klick
$('li#nav_koeche a').click(function() {
					
					
					$('div.content').not('div#koeche').animate({top: 400}, delay, 
														 function() { 														 
														 	$('div#koeche').show().animate({top: toppos}, 500 ).css({opacity: trans});
															delay=500;
														});
					
});


// ausstattung-Klick
$('li#nav_ausstattung a').click(function() {
					
					
					$('div.content').not('div#ausstattung').animate({top: 400}, delay, 
														 function() { 														 
														 	$('div#ausstattung').show().animate({top: toppos}, 500 ).css({opacity: trans});
															delay=500;
														});
					
});


// locations-Klick
$('li#nav_locations a').click(function() {
					
					
					$('div.content').not('div#locations').animate({top: 400}, delay, 
														 function() { 														 
														 	$('div#locations').show().animate({top: toppos}, 500 ).css({opacity: trans});
															delay=500;
														});
					
});


// Impressum-Klick
$('li#nav_impressum a, a.impr').click(function() {
					
					$('div.content').not('div#impressum').animate({top: 400}, delay, 
														 function() { 														 
														 	$('div#impressum').show().animate({top: toppos}, 500 ).css({opacity: trans});
															delay=500;
														});
					
});





// Navigation und Footer-Fadeeffekte
$('ul#footer a, #nav a').hover(function() { 
									 
									 $(this).fadeTo(100, 0.1);
									 }, function() {
									$(this).fadeTo(1000, 1.0);
									 	 
										 
									 });


// Schliessen-Funtionalität
$('span.close').css({display: "block"}).click( function() {
													 $('.content').animate({top: 400});
													 $('#flyer').fadeOut("slow");
													 $('.active').removeClass("active").removeAttr("class");
													 
													 delay = 0; // Delay wird wieder auf 0 gesetzt
													 });


$('.flyerlink').click(function() {
							   $('#flyer').fadeIn("slow");
							   
							   }) ;



});
