$('html').addClass('html-js');

$(function() {

	$('#stripe-table').each(function(i,o) {
	        var a = $('<a>').attr('id', 'weather-expand-collapse').attr('href', '#').appendTo(this).addClass('collapsed').toggle(function(e) {
		    $(this).removeClass('collapsed').addClass('expanded')
		    e.preventDefault();
		    $('table tbody', o).fadeIn('fast')
		}, function(e){
		    $(this).removeClass('expanded').addClass('collapsed')
		    e.preventDefault();
		    $('table tbody', o).fadeOut('fast')
		});
	});

	$('#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_0609.swf",
		 width:600,
		 height:475,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"}
	);
	$("div#home-push-marketing").flash(
		{src:"/flash/push-marketing.swf",
		 width:243,
		 height:136,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"}
	);
	$("div#sign-up").flash(
		{src:"/flash/email-form.swf",
		 width:248,
		 height:375,
		 background: '#ffffff', 
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"}
	);
	$("div#video").flash(
		{src:"/flash/telluride-star.swf",
		 width:720,
		 height:480,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"}
	);
	$("div#intro-video").flash(
		{src:"/flash/video-holder.swf",
		 width:960,
		 height:480,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"8"}
	);
	$("div#today-show-video").flash(
		{src:"/flash/capella-telluride-todayshow.swf",
		 width:500,
		 height:415,
		 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));
	});
	
	$("div#one-bedroom").flash({src:"/flash/vacation-rental.swf", width:550, height:375, wmode:"transparent", quality:"high"},{version:"8"},
		function(htmlOptions) {
			htmlOptions.flashvars.xmlFile = "/flash/xml/one-bedroom-condos.xml";
			$(this).html($.fn.flash.transform(htmlOptions));
	});
	$("div#two-bedroom").flash({src:"/flash/vacation-rental.swf", width:550, height:375, wmode:"transparent", quality:"high"},{version:"8"},
		function(htmlOptions) {
			htmlOptions.flashvars.xmlFile = "/flash/xml/two-bedroom-condos.xml";
			$(this).html($.fn.flash.transform(htmlOptions));
	});
	$("div#three-bedroom").flash({src:"/flash/vacation-rental.swf", width:550, height:375, wmode:"transparent", quality:"high"},{version:"8"},
		function(htmlOptions) {
			htmlOptions.flashvars.xmlFile = "/flash/xml/three-bedroom-condos.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#title-wrapper h1").sifr( { strSWF: '/flash/sabon.swf', strColor: '#2C3554', intPadding: [0, 0, 0, 0], strCase: 'upper', strWmode:'transparent'} );
	$("div.webcam-title 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'} );
	$('div.column h1').sifr(
		{ strSWF: '/flash/sabon.swf', strColor: '#FFFFFF', strWmode: 'transparent', intPadding: [0, 0, 0, 0], strCase: 'upper' },
		{ expressInstall: true }
	);
	$('div.push h4').sifr(
		{ strSWF: '/flash/sabon.swf', strColor: '#24334d', strWmode: 'transparent', intPadding: [0, 0, 0, 0], strCase: 'upper',  strFlashVars: 'textalign=center&'},
		{ 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#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 }
	);
	$('div#portal-content h3').sifr(
		{ strSWF: 'flash/sabon.swf', strColor: '#172f52', strWmode: 'transparent', intPadding: [0, 0, 0, 0], strCase: 'upper',strFlashVars: 'textalign=center&' },
		{ expressInstall: true }
	);
	$('div#interior-push h3').sifr(
		{ strSWF: 'flash/sabon.swf', strColor: '#081644', strWmode: 'transparent', intPadding: [0, 0, 0, 0], strCase: 'upper',strFlashVars: 'textalign=center&' },
		{ expressInstall: true }
	);
	$('div.res-content h4').sifr({ strSWF: '/flash/sabon.swf', strColor: '#2C3554', strWmode: 'transparent', intPadding: [0, 0, 0, 0], strCase: 'upper' },{ expressInstall: true });
	
/*---------------Calendar of Events ------------------*/
$(".vcalendar").eventPreview();

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

//trigger the expand collapse w/ SEO friendliness
//Packages
$('.package').packagePreview();

//Blog 
$('.blog-expandable').expand();
$('.entry').expand({ longClass: '.blog-long'});



});


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

};   
