var closed_hotel=0;
var closed_restaurant=0;
var closed_nightlife=0;
var flag_open_hotel=0;
var flag_open_restaurant=0;
var flag_open_nightlife=0;
function show_menu(num){
	if(num==1){		
		if($('.hotels_up').css('display') == "none"){
			hide_hotel(2);
			hide_hotel(3);
			
			$('#restaurants').css('background-position','-322px -150px');
			$('#nightlife').css('background-position','-630px -150px');
			
			//$('.hotels_up').show("slide", { direction: "up" }, 1000);
			$('.hotels_up').show();
			$('#hotels').css('background-position','0px -100px');		
			
			$('.menu-pane').jScrollPane({
				showArrows: true,
				verticalDragMinHeight		: 0,
				verticalDragMaxHeight		: 52
			});
			
			closed_hotel=1;
		}			
	}else if(num==2){
		if($('.restaurants_up').css('display') == "none"){
			hide_hotel(1);
			hide_hotel(3);
			$('#hotels').css('background-position','0px -150px');			
			$('#nightlife').css('background-position','-630px -150px');
			
			//$('.restaurants_up').show("slide", { direction: "up" }, 1000);
			$('.restaurants_up').show();
			$('#restaurants').css('background-position','-322px -50px');

			$('.menu-pane').jScrollPane({
				showArrows: true,
				verticalDragMinHeight		: 0,
				verticalDragMaxHeight		: 52
			});
			closed_restaurant=1;
		}
	}else if(num==3){
		if($('.nightlife_up').css('display') == "none"){
			hide_hotel(1);
			hide_hotel(2);
			
			$('#hotels').css('background-position','0px -150px');
			$('#restaurants').css('background-position','-322px -150px');
			
			
			//$('.nightlife_up').show("slide", { direction: "up" }, 1000);
			$('.nightlife_up').show();
			$('#nightlife').css('background-position','-630px 0px');
			
			$('.menu-pane').jScrollPane({
				showArrows: true,
				verticalDragMinHeight		: 0,
				verticalDragMaxHeight		: 52
			});
			closed_nightlife=1;
		}
		
	}
	
	$('.jspPane').css('left','0px');
	
}

$.preload([ 'sbe_nav_bg_home','sbe_nav_bg' ], {
	base:BASE_URL+'/images/',
	ext:'.png'
});

$(document).ready(function(){
	$("#hotels").hover(
	  function () {
		  closed_hotel=0;
		  flag_open_hotel=0;
	  }, 
	  function () {
		  setTimeout('hide_withOut_over(1)',1000);			
		  flag_open_hotel=1;//this variable, is used for close the menu if not have been put the mouse over the menu
		  closed_hotel=1;
	  }
	); 
	
	$("#restaurants").hover(
	  function () {
		  closed_restaurant=0;
		  flag_open_restaurant=0;
	  }, 
	  function () {
		  setTimeout('hide_withOut_over(2)',1000);			
		  flag_open_restaurant=1;//this variable, is used for close the menu if not have been put the mouse over the menu
		  closed_restaurant=1;
	  }
	);
	
	$("#nightlife").hover(
	  function () {
		  closed_nightlife=0;
		  flag_open_nightlife=0;
	  }, 
	  function () {
		  setTimeout('hide_withOut_over(3)',1000);			
		  flag_open_nightlife=1;//this variable, is used for close the menu if not have been put the mouse over the menu
		  closed_nightlife=1;
	  }
	);
	
	$("#drop_up").hover(
	  function () {
		  closed_hotel=0;
		  flag_open_hotel=0;
	  }, 
	  function () {
		  setTimeout('hide_hotel(1)',1000);					  
		  closed_hotel=1;
	  }
	);
	
	$("#drop_up1").hover(
	  function () {
		  closed_restaurant=0;
		  flag_open_restaurant=0;
	  }, 
	  function () {
		  setTimeout('hide_hotel(2)',1000);					  
		  closed_restaurant=1;
	  }
	);
	
	$("#drop_up2").hover(
	  function () {
		  closed_nightlife=0;
		  flag_open_nightlife=0;
	  }, 
	  function () {
		  setTimeout('hide_hotel(3)',1000);					  
		  closed_nightlife=1;
	  }
	);

	
});

function hide_hotel(num){
	if(num==1){
		if(closed_hotel==1){
			if($('.hotels_up').css('display') != "none"){
				if(VENUE_TYPE!="hotels"){
					$('#hotels').css('background-position','0px -150px');
				}	
				//$('.hotels_up').hide("slide", { direction: "up" }, 1000,function(){
				$('.hotels_up').hide("fade","fast",function(){
					if(($('.hotels_up').css('display') == "none") && ($('.restaurants_up').css('display') == "none") && ($('.nightlife_up').css('display') == "none")){
						if(VENUE_TYPE=="hotels"){
							$('#hotels').css('background-position','0px -100px');
						}else if(VENUE_TYPE=="restaurants"){
							$('#restaurants').css('background-position','-322px -50px');
						}else if(VENUE_TYPE=="nightlife"){
							$('#nightlife').css('background-position','-630px 0px');
						}	
						
					}
				});		
				closed_hotel=0;
				flag_open_hotel=0;
			}	
		}
	}else if(num==2){
		if(closed_restaurant==1){
			if($('.restaurants_up').css('display') != "none"){
				if(VENUE_TYPE!="restaurants"){
					$('#restaurants').css('background-position','-322px -150px');
				}	
				//$('.restaurants_up').hide("slide", { direction: "up" }, 1000,function(){
				$('.restaurants_up').hide("fade","fast",function(){
					if(($('.hotels_up').css('display') == "none") && ($('.restaurants_up').css('display') == "none") && ($('.nightlife_up').css('display') == "none")){
						if(VENUE_TYPE=="hotels"){
							$('#hotels').css('background-position','0px -100px');
						}else if(VENUE_TYPE=="restaurants"){
							$('#restaurants').css('background-position','-322px -50px');
						}else if(VENUE_TYPE=="nightlife"){
							$('#nightlife').css('background-position','-630px 0px');
						}
					}	
				});		
				closed_restaurant=0;
				flag_open_restaurant=0;
			}	
		}
	}else if(num==3){
		if(closed_nightlife==1){
			if($('.nightlife_up').css('display') != "none"){
				if(VENUE_TYPE!="nightlife"){
					$('#nightlife').css('background-position','-630px -150px');
				}	
				//$('.nightlife_up').hide("slide", { direction: "up" }, 1000,function(){
				$('.nightlife_up').hide("fade","fast",function(){
					if(($('.hotels_up').css('display') == "none") && ($('.restaurants_up').css('display') == "none") && ($('.nightlife_up').css('display') == "none")){
						if(VENUE_TYPE=="hotels"){
							$('#hotels').css('background-position','0px -100px');
						}else if(VENUE_TYPE=="restaurants"){
							$('#restaurants').css('background-position','-322px -50px');
						}else if(VENUE_TYPE=="nightlife"){
							$('#nightlife').css('background-position','-630px 0px');
						}
					}	
				});		
				closed_nightlife=0;
				flag_open_nightlife=0;
			}	
		}
	}			
}

function hide_withOut_over(num){
	if(num==1){
		if(flag_open_hotel==1){
			if(VENUE_TYPE!="hotels"){
				$('#hotels').css('background-position','0px -150px');
			}	
			//$('.hotels_up').hide("slide", { direction: "up" }, 1000,function(){
			$('.hotels_up').hide("fade","fast",function(){
				if(($('.hotels_up').css('display') == "none") && ($('.restaurants_up').css('display') == "none") && ($('.nightlife_up').css('display') == "none")){
					if(VENUE_TYPE=="hotels"){
						$('#hotels').css('background-position','0px -100px');
					}else if(VENUE_TYPE=="restaurants"){
						$('#restaurants').css('background-position','-322px -50px');
					}else if(VENUE_TYPE=="nightlife"){
						$('#nightlife').css('background-position','-630px 0px');
					}
				}	
			});		
			closed_hotel=0;
			flag_open_hotel=0;
		}
	}else if(num==2){
		if(flag_open_restaurant==1){
			if(VENUE_TYPE!="restaurants"){
				$('#restaurants').css('background-position','-322px -150px');
			}	
			//$('.restaurants_up').hide("slide", { direction: "up" }, 1000,function(){
			$('.restaurants_up').hide("fade","fast",function(){
				if(($('.hotels_up').css('display') == "none") && ($('.restaurants_up').css('display') == "none") && ($('.nightlife_up').css('display') == "none")){
					if(VENUE_TYPE=="hotels"){
						$('#hotels').css('background-position','0px -100px');
					}else if(VENUE_TYPE=="restaurants"){
						$('#restaurants').css('background-position','-322px -50px');
					}else if(VENUE_TYPE=="nightlife"){
						$('#nightlife').css('background-position','-630px 0px');
					}
				}	
			});		
			closed_restaurant=0;
			flag_open_restaurant=0;
		}
	}else if(num==3){
		if(flag_open_nightlife==1){
			if(VENUE_TYPE!="nightlife"){
				$('#nightlife').css('background-position','-630px -150px');
			}	
			//$('.nightlife_up').hide("slide", { direction: "up" }, 1000,function(){
			$('.nightlife_up').hide("fade","fast",function(){
				if(($('.hotels_up').css('display') == "none") && ($('.restaurants_up').css('display') == "none") && ($('.nightlife_up').css('display') == "none")){
					if(VENUE_TYPE=="hotels"){
						$('#hotels').css('background-position','0px -100px');
					}else if(VENUE_TYPE=="restaurants"){
						$('#restaurants').css('background-position','-322px -50px');
					}else if(VENUE_TYPE=="nightlife"){
						$('#nightlife').css('background-position','-630px 0px');
					}
				}	
			});		
			closed_nightlife=0;
			flag_open_nightlife=0;
		}
	}			
}
