// JavaScript Document


	$(document).ready(function() {
		var _inContent = false;
		var _totalHomeTabs = 0;
		
		$('.topMainMenu').show();

		
	function HideAllTabsHome() {
		$("#hpcDefault").hide();
		for (var x=0; x < _totalHomeTabs; x++) {
			$("#hpctab-" + x).hide();
		}
		for (var x=0; x < _totalHomeTabs; x++) {
			$("#hpc-" + x).removeClass("hpcSelect");
		}
	}
	
	function runHomeTabs() {
		$("#homePanelSelectorHousing").children().each(function(index) {
			_totalHomeTabs++;
				var _controlName = "hpc-" + index;
				var _tabName = "hpctab-" + index;
				$("." + _controlName).click(function() {
					HideAllTabsHome();
					$("#" + _tabName).fadeIn('fast');
				//$("#" + _controlName).addClass("hpcSelect");
				});
		});
		HideAllTabsHome();
		$("#hpcDefault").show();		
		$("#homePanelHousing").removeClass("hidden");
	}
	
	function enableSpecialsRollover() {
		// this is specifically for the default specials widget.
	    $(document).ready(function(){
		    $('div[name="require"]').each(function(index)   {
	            $(this).hover(function(event){
	               $(this).children().show("blind");
			            }, function(event){
			                $(this).children().hide("blind");
        		    });
    	    	});
	    	});
	}
	
	function activateHomeSpecialsCSS() {
		$("head").append('<link rel="stylesheet" type="text/css" href="/acc_img/specialsNew/papillonWidget/pswStyles.css"/>');
	}

		
		// Make the main menu bar work.
		function hideAllMenuPanels() {
			$('#menu-heliCities').hide();
			$('#menu-planeCities').hide();
			$('#menu-busCities').hide();
			$('#menu-raftCities').hide();
			$('#menu-contacts').hide();
		}
		
		$('.mm_heliTours').mouseover(function() {
			hideAllMenuPanels();
			$('#menu-heliCities').show();
		});
		$('#menu-heliCities').mouseleave(function() {
			hideAllMenuPanels();
		});
				
		$('.mm_airplaneTours').mouseover(function() {
			hideAllMenuPanels();
			$('#menu-planeCities').show();
		});
		$('#menu-planeCities').mouseleave(function() {
			hideAllMenuPanels();
		});
		
		$('.mm_busTours').mouseover(function() {
			hideAllMenuPanels();
			$('#menu-busCities').show();
		});
		$('#menu-busCities').mouseleave(function() {
			hideAllMenuPanels();
		});
		
		$('.mm_raftingTours').mouseover(function() {
			hideAllMenuPanels();
			$('#menu-raftCities').show();
		});
		$('#menu-raftCities').mouseleave(function() {
			hideAllMenuPanels();
		});
		
		$('.mm_guestServ').mouseover(function() {
			hideAllMenuPanels();
			$('#menu-contacts').show();
		});
		$('#menu-contacts').mouseleave(function() {
			hideAllMenuPanels();
		});
				
		$('a[rel="panelHide"]').mouseup(function() {
			hideAllMenuPanels();
		});
		
		if ($('#homePanelSelectorHousing').length>0) {
			runHomeTabs();
		}
		
		if ($('.pswCont').length>0 || $('.seasonalBG').length>0 ) {
			activateHomeSpecialsCSS();
			enableSpecialsRollover();
		}
		
	});
