//var $ = jQuery.noConflict();

// Navi hover Effect
var subnavduration = 100;
var subnavtimer = new Array();
function subnav_checkover (index) {
	$('.s_nav > UL > LI').eq(index).find(".subnav").css("display", "none");
	$('.s_nav > UL > LI').eq(index).find("A").removeClass("aktiv");
}

$(document).ready(function(){
	//Sprachwahl ausblenden
	//$(".sprache-nojs").hide();
	//$(".sprache-js").show();
	
	$('.lang_2').css("height","0px").css("opacity","0");
	$('.s_sprachwahl').css("height","20px").hover(function() {
		if($('.lang_2').html() != "")
		{
			$('.s_sprachwahl').css("height","40px");
			$('.lang_2').animate({ height: "18px", opacity: "1"}, 300);
		}
	},function() {
		if($('.lang_2').html() != "")
		{
			$('.s_sprachwahl').css("height","20px");
			$('.lang_2').animate({ height: "0px", opacity: "0"}, 300);
		}	
	});
	
	
	// Datepicker
	$('.buchen-input, #anreise, #abreise').datepicker({
		dateFormat: 'dd.mm.yy',
		firstDay: 1,
		monthNames: ['Jänner','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember']
	});
	
	// Carousel
	$('.jcarousel-skin-tango').jcarousel({
		scroll: 1,
		wrap: 'circular'
	});

	//$(".ppy .ppy-active").popeye();
	
	// Main Navi
	$('.s_nav > UL > LI').hover(function() {
		var index = $(".s_nav > UL > LI").index(this);
		$('.s_nav > UL > LI').eq(index).find(".subnav").css("display", "block");
		$('.s_nav > UL > LI').eq(index).find("A").addClass("aktiv");
		xposition = $('.s_nav > UL > LI').eq(index).find("A").offset().left;
		$('.s_nav > UL > LI').eq(index).find('.subnav').css("left", xposition + "px");
		clearTimeout(subnavtimer[index]);
	}, function() {
		var index = $(".s_nav > UL > LI").index(this);
		subnavtimer[index] = setTimeout('subnav_checkover(' + index + ')', subnavduration);
	});
	
	// PNG Fix

	$(".s_inhalt").pngFix();
	$(".s_logo").pngFix();
	$(".s_koerper").pngFix();
	$(".s_ueberschrift_rechte_spalte").pngFix();
	$(".i_teaser").pngFix();
});

function wp_gotourl (siteurl) {
	basehref = this.location.href;
	endpos = basehref.indexOf("/", 10);
	baseurl = basehref.substring(0,endpos);
	location.href = baseurl + '/' + siteurl;
}

