/* Languagebox
------------------------------------------- */
var myInterval = null;
function openLangs() {
	document.getElementById('language_dropdown').style.display = 'block';
	document.getElementById('language_dropdown').onmouseover = setMouse;
}
function setMouse() {
	document.getElementById('language_dropdown').onmouseout = intervalClose;
	if(myInterval != null) clearInterval(myInterval); 
}
function intervalClose() {
	myInterval = window.setInterval('closeLangs()', 1000);
}
function closeLangs() {
	document.getElementById('language_dropdown').style.display = 'none';
	clearInterval(myInterval); 
}

/* Cycler
------------------------------------------- */
function applyCycler(cycler, browse) {
	browse.append('<span class="prev"></span><span class="next"></span>');
	cycler.cycle({
		fx:     'scrollVert',
		speed:  1000,
		timeout: 3000,
		next:   browse.children('.next'),
		prev:   browse.children('.prev'),
		pause: 1,
		timeout: 8000,
		backwards: true
	});
}

/* Weather & Extrainfo Slider
------------------------------------------- */
jQuery(document).ready(function($) {
	Cufon.now();
	Cufon.replace('#content_header h1, #booking_box div.header h3',{fontFamily:'font1'});
	Cufon.replace('div.sidebar_title, div.award_window h1, div.teaserbox h1',{fontFamily:'font3'});

	// sliders
	applyCycler($('div.top-packages .cycle-inner'), $('div.top-packages'));

	$("a[class='moreinfos_link']").prettyPhoto({
		default_width: 960,
		default_height: 500,
		show_title: false,
		social_tools:'',
		iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>'
	});
});

/* Modify Dropdown Menu for smaller solutions
------------------------------------------- */
jQuery(document).ready(function($) {
	function resizeWindow(e) {
		if ($(window).width() <= 1300) {
			$("#mainnav ul ul ul").css('left','-100%');
		} else {
			$("#mainnav ul ul ul").css('left','100%');
		}
	}
	$(window).bind("resize", resizeWindow);
	resizeWindow();
	
	$("#mainnav ul ul").mouseover(function() {
		$(this).parents('li').children('a').trigger('mouseover');
	});
	$("#mainnav ul ul").mouseout(function() {
		$(this).parents('li').children('a').trigger('mouseout');
	});
});
