var HomePageUI = 
{
    Initialize : function () 
    {
		$('.home-pods li').hover(HomePageUI.ShowResortInfo,HomePageUI.HideResortInfo)
		$('.home-resort-tabs li:first-child a').addClass('active')
	
		HomePageUI.SwitchPods()
    },
	SwitchPods : function ()
	{
		$('.home-resort-tabs li a').click(function () 
		{
			var tabId = $(this).attr('href')
			$(tabId).show()
			$('.home-pods div.home-pod').not(tabId).hide()
			$('.home-resort-tabs li a').removeClass('active')
			$(this).addClass('active')
						
			// set up Flash
			var homeFlash = document.getElementById("home-flash");
			var hasFlash = $('.has-flash')
			
			// check for Flash object and then call Flash
			if (hasFlash.length) {
				homeFlash.switchIslands()
			}
			
			//non-Flash
			var imgDiv1, imgDiv2
			imgDiv1 = $('.non-flash .resort-one')
			imgDiv2 = $('.non-flash .resort-two')
			
			if (imgDiv1.is(':visible')) {
				imgDiv1.hide()
				imgDiv2.show()
			} else {
				imgDiv2.hide()
				imgDiv1.show()
			}
			
			return false
		})
	},
	ShowResortInfo : function ()
	{
		$(this).children('div.resort-pop-up').show()
		$(this).next('a').addClass('active')
	},
	HideResortInfo : function ()
	{
		$(this).children('div.resort-pop-up').hide()
		$(this).next('a').removeClass('active')
	}
}

$(document).ready(HomePageUI.Initialize)
