$(function() {
// Sample usage of jquery.flash plugin - remove if not needed
	/*	If given the following markup:

	<div id="masthead">
		<img src="images/mastheads/flash-alt.jpg" alt="" /><br />
	</div>
	
	you would use the following to replace the alternate content:

	$("div.slideshow").each(function() {
		var file = $(this).attr("id");
		$(this).flash(
			{src:"flash/photo_gallery.swf",
			 width:466,
			 height:416,
			 wmode:"transparent",
			 quality:"high"},
			 {version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.configFile = "flash/xml/gallery_config.xml";
					htmlOptions.flashvars.xmlFile = "flash/xml/images_" + file + ".xml";
					$(this).html($.fn.flash.transform(htmlOptions));
			}
		);
	});
	*/


	$("div#home-masthead").flash(
		{src:"flash/homepage-flash.swf",
		 width:923,
		 height:265,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"7",update:false},
		function(htmlOptions) {
			htmlOptions.flashvars.xmlPath = "/flash/xml/home-masthead.xml";
			$(this).html($.fn.flash.transform(htmlOptions));
		});
	
	// JS that adds current-offer to the first offer, since for CMT pattern all the markup needs to be the same.
	$(".home-push-center-offer:first").addClass("current-offer");
	
	$("#next-offer").click(function() {
		$(".current-offer").each(function() {
			var offer = $(this);
			offer.removeClass("current-offer");
			var $next = offer.next();
			$next = $next.length ? $next : offer.siblings(":first");
			$next.addClass("current-offer");
		});
		return false;
	});
	
	
	$("div#recreation-video").flash(
		{src:"video/daytona-florida-resort.swf",
		 width:625,
		 height:530,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"7"});
	
	$("div#shores-video").flash(
		{src:"flash/shores_video.swf",
		 width:480,
		 height:230,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"7"});
		
	$("div#push-marketing").flash(
		{src:"flash/home_pushmarket.swf",
		 width:174,
		 height:167,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"7"});
	
	$("div#dhr-flash").flash(
		{src:"http://www.destinationhotels.com/flash/branding/flash_logoDhr.swf?link=shoresresort",
		 width:250,
		 height:25,
		 wmode:"transparent",
		 allowScriptAccess:"always",
		 quality:"high"},
		 {version:"7"});
	
	$("div.slideshow").each(function() {
		var file = $(this).attr("id");
		$(this).flash(
			{src:"flash/photo_gallery.swf",
			 width:466,
			 height:416,
			 wmode:"transparent",
			 quality:"high"},
			 {version:"8"},
				function(htmlOptions) { //Use this to specify a query string, take out if not needed.
					htmlOptions.flashvars.configFile = "flash/xml/gallery_config.xml";
					htmlOptions.flashvars.xmlFile = "flash/xml/images_" + file + ".xml";
					$(this).html($.fn.flash.transform(htmlOptions));
			}
		);
	});

	$('div#content h1').sifr( { strSWF: '/flash/century-gothic.swf', strColor: '#FFFFFF', strWmode: 'transparent', strFlashVars: 'textalign=right&', strCase: 'upper' }, { expressInstall: true } );
	$('div#content h2').sifr( { strSWF: '/flash/myriad-pro.swf', strColor: '#137189', strWmode: 'transparent' }, { expressInstall: true } );
	//$('div#content h3').sifr( { strSWF: 'flash/myriad-pro.swf', strColor: '#137189', strWmode: 'transparent' }, { expressInstall: true } );


	$('div.form-help').hide();
	$('a.help-link').toggle( function() {
		$(this).parents('div.field').children('div.form-help').show();
		return false;
	},function(){ 
	  $(this).parents('div.field').children('div.form-help').hide();
	  return false;
	});
	
	
	//Calendar Of Events
	$(".vcalendar").eventPreview();
	
	// For Each Package Wrapper add a Toggle Function if Neccessary
	$("div.entry").each(function() {
		if( $(this).children().is('.comment-long') ) {
			$('.comment-long').hide();
			$(this).children('div.author').before('<span class="comment-more" ><a href="#">(read more...)</a></span>');
		}
	});
	
	$("span.comment-more a").toggle(function() {
		$(this).parents("div.entry").find("div.comment-long").animate({
			height: 'show'
		}, 'slow');
		// Changes the Text of the Control
		$(this).html("(read less...)");
	}, function() {
		$(this).parents("div.entry").find("div.comment-long").animate({
			height: 'hide'
		}, 'slow');
		// Changes the Text of the Control
		$(this).html("(read more...)");
	});
	

// Sample sifr usage - remove if not needed
	/*
	// intPadding array order is: left, top, right, bottom - must match css for corresponding element
	$('div#content h2').sifr(
		{ strSWF: 'flash/font-name.swf', strColor: '#cc0000', strLinkColor: '#cccc00', strHoverColor: '#cc00cc', strWmode: 'transparent', intPadding: [35, 0, 0, 0], strFlashVars: 'textalign=center&', strCase: 'upper' },
		{ expressInstall: true }
	);
	*/

	//social media sharing
	$('.share-link').click(function() {
		$('.share-panel').hide();
		$(this).parents('.entry').find('.share-panel').css('display','inline');
		return false;
	});
	$('.share-close').click(function(){
		$(this).parents('.entry').find('.share-panel').slideUp('fast');
		return false;
	});

// Adds hover class for IE and animation for drop down nav - remove if not needed
	$("ul.sec-nav li").hover( function() { 
		$("ul", this).show(); 
	}, function() {
		$("ul", this).hide();
	});
    if (document.all) {
        $("ul.sec-nav li").hoverClass("over");
    }
	
});

// Function to add/remove "over" class for drop down nav - remove if not needed
$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});

};   
