function clickLang(li){
	li.blur();
	if (li.hasClass('opened')) {
		li.removeClass('opened').children('ul').slideUp(300);
		li.stopTime();
	}
	else {
		li.addClass('opened').children('ul').slideDown(300);
		li.oneTime(1500, function() {
			clickLang(li);
		});
	}
}

function openbooking(lang) {
	jQuery(function($){
		jQuery().colorbox({
			width:"750",
			height:"80%",
			href:"https://ibe.seekda.com/channelManager/ibe/AT_NEUSTIFT?languageCode="+lang,
			iframe:true
		});
	});
}

jQuery(function($){

	setupCalendar($('#dt_fm_day'), '+1');
	setupCalendar($('#dt_to_day'), '+8');

	$('a.uid109').colorbox({
			width:"750",
			height:"80%",
			iframe:true
		});
	
	jQuery(".iFrame").colorbox({
		width:"750",
		height:"80%",
		iframe:true
	});
	$('.iFrameAvailability').colorbox({
		width:"920",
		height:"280",
		iframe:true
	});
	jQuery("a.panoWin").colorbox({
		width:"620",
		height:"470",
		iframe:true
	});
	/*
	 * Sprachenmenü
	 */
	
	$('#metanav li.lang > a').click(function(){
		clickLang($(this).parent());
		return false;
	});
	var li = $('#metanav li.lang');
	li.removeClass('lang').addClass('nolang').click(function(){
		clickLang($(this));
	});
	
	li.children('ul').mousemove(function(){
		li.stopTime();
	}).mouseleave(function(){
		li.oneTime(1500, function() {
			clickLang(li);
		});
	});
	
	/*
	 * Slider auf Startseite
	 */
	if($('body.startpage #sliders h3').length) {
		$('body.startpage #sliders h3').addClass('clickable').click(function(){
			if ($(this).hasClass('clicked')) {
				$(this).removeClass('clicked').parent().animate({
					top: 0,
					height: 35
				}, 1000);
			}
			else {
				$(this).addClass('clicked').parent().animate({
					top: -$(this).next().height(),
					height: $(this).next().height()+35
				}, 1000);
			}
		});
	}

	//stick the footer at the bottom of the page if we're on an iPad/iPhone due to viewport/page bugs in mobile webkit
	if (navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod') {
		$("#footer").css("position", "static");
	};
});
