$(function(){
	$("#nav li.bad").mouseover( function() {
		$('#kopfbilder img.Bad').css('z-index', '11') 
		$("#kopfbilder img.Bad").animate({opacity: "1"}, {queue:false,duration:500});
	});
	$("#nav li.bad").mouseout( function() { 
		$("#kopfbilder img.Bad").animate({opacity: "0"}, {queue:false,duration:500});
		window.setTimeout("$('#kopfbilder img.Bad').css('z-index', '0')", 501);
	});
	
	$("#nav li.sport").mouseover( function() {
		$('#kopfbilder img.Sport').css('z-index', '11') 
		$("#kopfbilder img.Sport").animate({opacity: "1"}, {queue:false,duration:500});
	});
	$("#nav li.sport").mouseout( function() { 
		$("#kopfbilder img.Sport").animate({opacity: "0"}, {queue:false,duration:500});
		window.setTimeout("$('#kopfbilder img.Sport').css('z-index', '0')", 501);
	});	
	
	$("#nav li.sauna").mouseover( function() {
		$('#kopfbilder img.Sauna').css('z-index', '11') 
		$("#kopfbilder img.Sauna").animate({opacity: "1"}, {queue:false,duration:500});
	});
	$("#nav li.sauna").mouseout( function() { 
		$("#kopfbilder img.Sauna").animate({opacity: "0"}, {queue:false,duration:500});
		window.setTimeout("$('#kopfbilder img.Sauna').css('z-index', '0')", 501);
	});	
	
	$("#nav li.wellness").mouseover( function() {
		$('#kopfbilder img.Wellness').css('z-index', '11') 
		$("#kopfbilder img.Wellness").animate({opacity: "1"}, {queue:false,duration:500});
	});
	$("#nav li.wellness").mouseout( function() { 
		$("#kopfbilder img.Wellness").animate({opacity: "0"}, {queue:false,duration:500});
		window.setTimeout("$('#kopfbilder img.Wellness').css('z-index', '0')", 501);
	});

	$("#nav li.restaurant").mouseover( function() {
		$('#kopfbilder img.Restaurant').css('z-index', '11') 
		$("#kopfbilder img.Restaurant").animate({opacity: "1"}, {queue:false,duration:500});
	});
	$("#nav li.restaurant").mouseout( function() { 
		$("#kopfbilder img.Restaurant").animate({opacity: "0"}, {queue:false,duration:500});
		window.setTimeout("$('#kopfbilder img.Restaurant').css('z-index', '0')", 501);
	});	

	$("#nav li.infos").mouseover( function() {
		$('#kopfbilder img.Infos').css('z-index', '11') 
		$("#kopfbilder img.Infos").animate({opacity: "1"}, {queue:false,duration:500});
	});
	$("#nav li.infos").mouseout( function() { 
		$("#kopfbilder img.Infos").animate({opacity: "0"}, {queue:false,duration:500});
		window.setTimeout("$('#kopfbilder img.Infos').css('z-index', '0')", 501);
	});	


	$("a#kontaktlink").mouseover( function() {
		$("#kontaktformular").animate({height: "405px"}, {queue:false,duration:200});
	});
	$("a#kontaktlink").mouseout( function() {
		$("#kontaktformular").animate({height: "395px"}, {queue:false,duration:200});
	});	
	
	$("a#kontaktlink").mousedown( function() {
		$(this).css('display', 'none')
		window.setTimeout("$('a#kontaktformular_x').css('display', 'block')", 201);
		window.setTimeout("$('#kontaktformular').animate({height: '1000px'}, {queue:false,duration:200})", 201);
		SetzeKontaktFormularSource();
	});

	$("a#kontaktformular_x").mousedown( function() {
		$(this).css('display', 'none')
		window.setTimeout("$('a#kontaktlink').css('display', 'block')", 201);
		window.setTimeout("$('#kontaktformular').animate({height: '395px'}, {queue:false,duration:200})", 201);
		SetzeKontaktFormularSource();
	});

});



jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

jQuery(function( $ ){
	$('.kasten').serialScroll({
		target:'.kasten_content',
		items:'img', // Selector to the items ( relative to the matched elements, '#sections' in this case )
		prev:'a.prev',// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
		next:'a.next',// Selector to the 'next' button (absolute too)
		axis:'x',// The default is 'y' scroll on both ways
		navigation:'.teaserbalken ul.weiterbuttons li',
		duration:1000,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
		force:true, // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
		interval:10000,
		
		onBefore:function( e, elem, $pane, $items, pos ){

		},
		onAfter:function( elem ){
		    $('.teaserbalken ul.weiterbuttons li') // all the links
		       .removeClass('selected').addClass('notselected')
			if (elem.id)
			{
				var buttonId = elem.id.replace(/img/, "weiterbutton")
			}
		    $('.teaserbalken ul.weiterbuttons li.'+buttonId) 
		       .addClass('selected').removeClass('notselected')
		}
	});
});
























