$(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#masthead").flash(
		{src:"flash/home.swf",
		 width:600,
		 height:300,
		 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.xml";
				$(this).html($.fn.flash.transform(htmlOptions));
		});
	*/
	$('html').addClass('html-js');

	$('#news-listing-toggle').toggle(function() {
	    $('#news-listing').slideDown('slow');
	    $(this).addClass('toggled');
	    return false;
	}, function() {
	    $('#news-listing').slideUp('slow');
	    $(this).removeClass('toggled');
	    return false;
	});
	
	$('div#jcycle-packages-push').each(function() { $(this).cycle({ 
		fx:     'scrollHorz', 
		speed:  1000, 
		timeout: 0, 
		next:   '#next-push', 
		prev:   '#previous-push',
		cleartypeNoBg:true
		});
	});	
	
		$("div#home-flash").flash(
		{src:"/flash/homepage-small.swf",
		 width:600,
		 height:500,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"}
	);
	$("div#flash-masthead").flash(
		{src:"flash/family-escape-masthead.swf",
		 width:695,
		 height:504,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"},
			function(htmlOptions) { //Use this to specify a query string, take out if not needed.
			//	htmlOptions.flashvars.epostConfigXML="/flash/xml/epostConfig.xml";
				htmlOptions.flashvars.imagesXML="/flash/xml/family-escape-images.xml";
				//htmlOptions.flashvars.langXML="/flash/xml/i18n/en_formLabels.xml"; //en is language code, on production it looks like "flash/xml/i18n/"+LANG+"_formLabels.xml"
				$(this).html($.fn.flash.transform(htmlOptions));
		});	

	$('#tabbed-offers').tabs();

/*
	$(".home #push-marketing").flash(
		{src:"/flash/push-marketing.swf",
		 width:243,
		 height:155,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"}
	);
*/
          $("div#flash-signup").flash(
        {src:"/flash/email-form-en.swf",
         width:248,
         height:437,
         wmode:"transparent",
         quality:"high"},
         {version:"8"}
    );
    
		$("div#photo-gallery").flash(
		{src:"/flash/photo_gallery.swf",
		 width:648,
		 height:481,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"},
			function(htmlOptions) { //Use this to specify a query string, take out if not needed.
				htmlOptions.flashvars.epostConfigXML="/flash/xml/epostConfig.xml";
				htmlOptions.flashvars.imagesXML="/flash/xml/images.xml";
				htmlOptions.flashvars.langXML="/flash/xml/i18n/en_formLabels.xml"; //en is language code, on production it looks like "flash/xml/i18n/"+LANG+"_formLabels.xml"
				$(this).html($.fn.flash.transform(htmlOptions));
		});	


// 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 }
	);
	*/
$("div#title-wrapper h1").sifr( { strSWF: '/flash/sabon.swf', strColor: '#666633', intPadding: [0, 0, 0, 0], strCase: 'upper', strWmode:'transparent'} );
$("div#right-content h1").sifr( { strSWF: '/flash/sabon.swf', strColor: '#666633', intPadding: [0, 0, 0, 0], strCase: 'upper', strWmode:'transparent'} );
$("div#title-wrapper h2").sifr( { strSWF: '/flash/sabon.swf', strColor: '#666633', intPadding: [28, 3, 0, 0], strCase: 'upper', strWmode:'transparent'} );
$("div#content h3").sifr( { strSWF: '/flash/sabon.swf', strColor: '#666633', intPadding: [0, 0, 0, 0], strCase: 'upper', strWmode:'transparent'} );

$("div.push h3").sifr( 
	{ strSWF: './flash/sabon.swf', strColor: '#666633', intPadding: [0, 0, 0, 0], strCase: 'upper', strWmode:'transparent'}, 
	{ expressInstall: true }
);

// Adds hover class for IE and animation for drop down nav - remove if not needed
	/**/
	$("ul#nav-primary li").hover(
       function(){ $("ul", this).show(); }, 
        function() { 
			$("ul", this).hide();  
		} 
    );
    if (document.all) {
        $("ul#nav-primary li").hoverClass("sfhover");
    }
	
//reservation console
	$("#reserve").submit(function(){
		//return false;
		var today = formatDate(new Date(), "dd/MM/yyyy");
		var temp = $("#arrive").attr("value") || today;
		temp = temp.split("/");
		temp = temp[0]+"/"+temp[1]+"/"+temp[2];
		$("#DateIn").attr("value",temp);
		temp = new Date();
		temp.setDate(temp.getDate() + 1);
		var tomorrow = formatDate(temp, "dd/MM/yyyy");
		temp = $("#depart").attr("value") || tomorrow;
		temp = temp.split("/");
		temp = temp[0]+"/"+temp[1]+"/"+temp[2];
		$("#DateOut").attr("value",temp);
	});
	
/*------------Specials and Packages Expand Collapse w/ SEO friendliness--------*/
$('.package').packagePreview();

/*---------------Calendar of Events ------------------*/
$(".vcalendar").eventPreview();



$('#specials-container').tabs(1);

	$('#mycarousel').each(function() { 
		$(this).jcarousel({scroll:5});
		$("div.jcarousel-copy").hide();
		$('a.jtoggle').click(function(){
			var href = $(this).attr("href");
			$(".jcarousel-copy").hide();
			$(href).show();
			return false;
			});
	 });


});

// 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); }
		);
	});

};   
