$(document).ready(function() {
	//popup
	if(!($.cookie('popped'))) {
        	
		$("#dialog-modal").dialog({
			height: 360,
			width: 500,
			modal: true,
			hide: 'slide'	
		});
	   
		$.cookie('popped', '1', { expires: 365 });
	}
	
	$(".closeD").live('click', function() {
		$("#dialog-modal").dialog('close');
		return false;
	 })

	/*$('.show-more').click(function(){
		$(this).parent().siblings('.package-desc').toggle();
		return false;
	});*/
	
	// FLASH SUCKS - add the wmode param as transparent
	$('object').append('<param name="wmode" value="transparent" />');
	// FLASH SUCKS - if it's wmode is not transparent, make it so
	$('object param[name="wmode"]').attr('value','transparent');
	$("embed").attr("wmode", "opaque");

	$('.tts-view,.show-more').click(function(){
		$(this).parent().siblings('.package-desc').toggle();
		return false;
	});
	
	
	$('#box1link').live('click', function() {
		$(this).addClass('on');
		$('#box2link').removeClass('on');
		$('#box2form').hide('fast');
		$('#box1form').show('fast');
		return false;
	});
	
	$('#box2link').live('click', function() {
		$(this).addClass('on');
		$('#box1link').removeClass('on');
		$('#box1form').hide('fast');
		$('#box2form').show('fast');
		return false;
	});
	
	$.datePicker.setDateFormat('mdy', '/');
	$(".date-picker").datePicker();
	
	// search form tabs - show/hide
	$('#booking-panel-tabs a').click(function(){
		$('#booking-panel-tabs a').addClass('inactive');
		$(this).removeClass('inactive');
		$('.booking-form').hide();
		$('#'+$(this).attr('rel')).fadeIn('fast');
		return false;
	});
	
	// compliant new window code
	$('a[rel="external"]').attr('target', '_blank');
	
	// header promo panel IN TEST AND TARGET FOR THIS TEST
	
/*
runOne();
*/
	
	// fancybox
	$("a.fancy-image").fancybox();
	
	// video section tabs
	$(".video-list-tabs li a").click(function(){
		$(".video-list-tabs li a").removeClass('selected'); // kill selected tab state
		$("ul.video-list").hide(); // hide all video thumbs
		$(this).addClass('selected'); // highlight current tab
		var current_video_section = $(this).attr('href'); // grab the section to show
		$("ul#"+current_video_section).fadeIn('fast'); // show the current section
		return false;
	});
	
	// news section tabs
	$(".news-list-tabs li a").click(function(){
		$(".news-list-tabs li a").removeClass('selected'); // kill selected tab state
		$("ul.news-list").hide(); // hide all news thumbs
		$(this).addClass('selected'); // highlight current tab
		var current_news_section = $(this).attr('href'); // grab the section to show
		$("ul#"+current_news_section).fadeIn('fast'); // show the current section
		return false;
	});
	
	// form placeholder text removal
	$('form input').focus(function(){
		if($(this).val() == "Email Address" || $(this).val() == "Zip Code"){
			$(this).val('');
		}
	});
	
	
var lpMTagConfig = {'lpServer' : "server.iad.liveperson.net",'lpNumber' : "32057810",'lpProtocol' : (document.location.toString().indexOf('https:')==0) ? 'https' : 'http'}; function lpAddMonitorTag(src){if(typeof(src)=='undefined'||typeof(src)=='object'){src=lpMTagConfig.lpMTagSrc?lpMTagConfig.lpMTagSrc:'/hcp/html/mTag.js';}if(src.indexOf('http')!=0){src=lpMTagConfig.lpProtocol+"://"+lpMTagConfig.lpServer+src+'?site='+lpMTagConfig.lpNumber;}else{if(src.indexOf('site=')<0){if(src.indexOf('?')<0)src=src+'?';else src=src+'&';src=src+'site='+lpMTagConfig.lpNumber;}};var s=document.createElement('script');s.setAttribute('type','text/javascript');s.setAttribute('charset','iso-8859-1');s.setAttribute('src',src);document.getElementsByTagName('head').item(0).appendChild(s);} if (window.attachEvent) window.attachEvent('onload',lpAddMonitorTag); else window.addEventListener("load",lpAddMonitorTag,false);
	
});


	
	
function setUpTabs(){
	if('#media-tabs'){
		$('#media-tabs a').click(function(){
			var activetab = $(this).attr('href');
			$(this).parent().siblings().children('a').removeClass('active');
			$(this).addClass('active');
			$('#media .content-container').hide();
			$('#'+activetab).show();
			return false;
		});
	}
	$('#content-tabs a').click(function(){
		var activetab = $(this).attr('href');
		$(this).parent().siblings().children('a').removeClass('active');
		$(this).addClass('active');
		$('#details-content .content-container-bigger').hide();
		$('#'+activetab).show();
		if(activetab == "Specials"){
			createMap(); // calls the map load function
		}
		return false;
	});
}

function runOne(){
		$('#promo-slideshow').show();
		 if($('#promo-slideshow').length > 0){
			$('#promo-slideshow').after('<div id="promo-slideshow-nav"></div>').cycle({ 
				fx:     'fade', 
				speed:  1000, 
				timeout: 7000, 
				pager:  '#promo-slideshow-nav',
				pause: 1 
			});
		}
	}
function runTwo(){
	$('#promo-slideshow2').show();
	if($('#promo-slideshow2').length > 0){
		$('#promo-slideshow2').after('<div id="promo-slideshow-nav"></div>').cycle({ 
			fx:     'fade', 
			speed:  1000, 
			timeout: 7000, 
			pager:  '#promo-slideshow-nav',
			pause: 1 
		});
	}
}

