﻿$(document).ready(function(){
	
	/*
	//HANDLE MENU:
	$timeOutTimer = "";
	$menuTimerActive = 0;
	$menuOpen = 0;
	*/
	

	/*
	//Handle menu items:
	$("#menuContainer").find(".menu").each(function(){
		$("li").each(function(){
			
			$(this).mouseleave(function(){
				if($(this).parent().attr("class") == "menulevel2"){
					$(this).children("ul").hide();
				}
				if($(this).parent().attr("class") == "menu"){
					$menuOpen = $menuOpen - 1;
					if($menuOpen < 1){
						hideSubMenu($(this).attr("id"));
					}
					else{
						$(this).children("ul").hide();
					}
				}
				else{
					$(this).children("ul").hide();
				}
			});
			
			$(this).mouseenter(function(){
				if($menuTimerActive == 1){
					$timeOutTimer = clearTimeout($timeOutTimer);
				}
				if($(this).parent().attr("class") == "menu"){
					$(this).parent().children("li").children("ul").hide();
				}
				if($(this).parent().attr("class") == "menu" && $(this).find("a").html() == "Hotel"){
					if (ua.mozilla) {
						$(this).children("ul").css("left","-3px");
					}
					else{
						$(this).children("ul").css("left","-4px");
					}
				}
				else{
					$thisMainMenu = $(this).parent().parent().find("a").html();
					$(this).parent().parent().parent().children("li").children("ul").each(function(){
						if($(this).parent().find("a").html() != $thisMainMenu){
							$(this).hide();
						}
					});
				}
				
				//Check if page is contact, if so resize width of submenu:
				if($(this).children("a").html() == "Contact"){
					if (ua.mozilla) {
						$(this).children("ul").children("li").width(169);
					}
					else{
						$(this).children("ul").children("li").width(168);
					}
				}
				
				//Continue:
				$(this).children("ul").slideDown("fast");
			});

		});
				
	});
	
	
	function hideSubMenu(id){
		$menuTimerActive = 1;
		//$timeOutTimer = setTimeout('$("#'+id+'").children("ul").hide(); $menuTimerActive = 0;',700);
		
		$timeOutTimer = window.setTimeout(function() {
			$("#"+id).children("ul").slideUp("fast", function(){
				$("#"+id).children("ul").hide(); $menuTimerActive = 0;
			});
		}, 200);
		
	}
	*/

	





});

