$(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));
		});
	*/
	
	$('div#jcycle-packages-push').each(function() { $(this).cycle({ 
		fx:     'scrollHorz', 
		speed:  1000, 
		timeout: 0, 
		next:   '#next-push', 
		prev:   '#previous-push',
		cleartypeNoBg:true
		});
	});	
	

    $("div#flash-signup-en").flash(
        {src:"/flash/email-form-en.swf",
         width:248,
         height:437,
         wmode:"transparent",
         quality:"high"},
         {version:"8"}
    );
    
	$("div#home-flash").flash(
		{src:"/flash/homepage.swf",
		 width:600,
		 height:500,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"}
	);
	
	$("div#two-villa").flash({src:"/flash/vacation-rental.swf", width:550, height:375, wmode:"transparent", quality:"high"},{version:"8"},
		function(htmlOptions) {
			htmlOptions.flashvars.xmlFile = "/flash/xml/two-villa.xml";
			$(this).html($.fn.flash.transform(htmlOptions));
	});
	$("div#three-villa").flash({src:"/flash/vacation-rental.swf", width:550, height:375, wmode:"transparent", quality:"high"},{version:"8"},
		function(htmlOptions) {
			htmlOptions.flashvars.xmlFile = "/flash/xml/three-villa.xml";
			$(this).html($.fn.flash.transform(htmlOptions));
	});
	$("div#four-villa").flash({src:"/flash/vacation-rental.swf", width:550, height:375, wmode:"transparent", quality:"high"},{version:"8"},
		function(htmlOptions) {
			htmlOptions.flashvars.xmlFile = "/flash/xml/four-villa.xml";
			$(this).html($.fn.flash.transform(htmlOptions));
	});
	$("div#two-casita").flash({src:"/flash/vacation-rental.swf", width:550, height:375, wmode:"transparent", quality:"high"},{version:"8"},
		function(htmlOptions) {
			htmlOptions.flashvars.xmlFile = "/flash/xml/two-casita.xml";
			$(this).html($.fn.flash.transform(htmlOptions));
	});
	$("div#three-casita").flash({src:"/flash/vacation-rental.swf", width:550, height:375, wmode:"transparent", quality:"high"},{version:"8"},
		function(htmlOptions) {
			htmlOptions.flashvars.xmlFile = "/flash/xml/three-casita.xml";
			$(this).html($.fn.flash.transform(htmlOptions));
	});
	$("div#four-casita").flash({src:"/flash/vacation-rental.swf", width:550, height:375, wmode:"transparent", quality:"high"},{version:"8"},
		function(htmlOptions) {
			htmlOptions.flashvars.xmlFile = "/flash/xml/four-casita.xml";
			$(this).html($.fn.flash.transform(htmlOptions));
	});
	$("div#five-hacienda").flash({src:"/flash/vacation-rental-hacienda.swf", width:550, height:375, wmode:"transparent", quality:"high"},{version:"8"},
		function(htmlOptions) {
			htmlOptions.flashvars.xmlFile = "/flash/xml/five-hacienda.xml";
			$(this).html($.fn.flash.transform(htmlOptions));
	});	
		 
	$("div#photo-gallery").flash(
		{src:"flash/photo_gallery.swf",
		 width:648,
		 height:481,
		 wmode:"transparent",
		 allowfullscreen:"true",
		 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.features h3").sifr( { strSWF: '/flash/sabon.swf', strColor: '#2C3554', intPadding: [0, 0, 0, 0], strCase: 'upper', strWmode:'transparent'} );
	$("div.amenities h3").sifr( { strSWF: '/flash/sabon.swf', strColor: '#5e5e5e', intPadding: [0, 0, 0, 0], strCase: 'upper', strWmode:'transparent'} );
	
	$("div#title-wrapper h1").sifr( { strSWF: '/flash/sabon.swf', strColor: '#2C3554', intPadding: [0, 0, 0, 0], strCase: 'upper', strWmode:'transparent'} );
	$("div#title-wrapper h2").sifr( { strSWF: '/flash/sabon.swf', strColor: '#939598', intPadding: [28, 3, 0, 0], strCase: 'upper', strWmode:'transparent'} );

	$('body.quotes div#content h1.subheader').sifr({ strSWF: '/flash/sabon-bold.swf', strColor: '#2C3554', strWmode: 'transparent', intPadding: [0, 0, 0, 0], strCase: 'upper' },{ expressInstall: true });

	$('div#content h1').sifr(
		{ strSWF: '/flash/sabon.swf', strColor: '#2C3554', strWmode: 'transparent', intPadding: [0, 0, 0, 0], strCase: 'upper' },
		{ expressInstall: true }
	);
	
	$('div#content h2').sifr(
		{ strSWF: '/flash/sabon.swf', strColor: '#676666', strWmode: 'transparent', intPadding: [0, 0, 0, 0], strCase: 'upper' },
		{ expressInstall: true }
	);
	if( !$('body').hasClass('residences') ){
		$('div#content h3').sifr(
			{ strSWF: '/flash/sabon.swf', strColor: '#2C3554', strWmode: 'transparent', intPadding: [0, 0, 0, 0], strCase: 'upper' },
			{ expressInstall: true }
		);
	}
	
	$('div.res-content h4').sifr({ strSWF: '/flash/sabon.swf', strColor: '#2C3554', strWmode: 'transparent', intPadding: [0, 0, 0, 0], strCase: 'upper' },{ expressInstall: true });
	
	$('div#right-content h1').sifr(
		{ strSWF: '/flash/sabon.swf', strColor: '#2C3554', strWmode: 'transparent', intPadding: [0, 0, 0, 0], strCase: 'upper' },
		{ expressInstall: true }
	);
	$("div.push h3").sifr( 
		{ strSWF: '/flash/sabon.swf', strColor: '#2C3554', intPadding: [0, 0, 0, 0], strCase: 'upper', strWmode:'transparent'}, 
		{ expressInstall: true }
	);
	
/*---------------SEO friendly Calendar of Events ------------------*/
$(".vcalendar").eventPreview();	
/*------------Specials and Packages Expand Collapse w/ SEO friendliness--------*/
$('.package').packagePreview();

// 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);
	});
	
	
	
});


// 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); }
		);
	});

};   