$(function() {

	// Sifr
	$('div#content-two h2').sifr({ strSWF: 'flash/mrs-eaves-smallcaps.swf', strColor: '#985541', strWmode: 'transparent'}, { expressInstall: true });

	// Flash
	$("div#dhr-logo").flash( {src:"flash/flash_logoDhr-squaw.swf?link=squawcreek", width:250, height:25, wmode:"transparent", quality:"high"}, {version:"7"});
	$("div#deluxe-flash").flash( {src:"flash/deluxe-rooms.swf", width:273, height:350, wmode:"transparent", quality:"high"}, {version:"7"});
	$("div#penthouse-flash").flash( {src:"flash/penthouses.swf", width:273, height:350, wmode:"transparent", quality:"high"}, {version:"7"});
	$("div#home-inset-flash").flash( {src:"flash/fireplace-suite.swf", width:273, height:350, wmode:"transparent", quality:"high"}, {version:"7"});
	$("div#interactive-map").flash( {src:"flash/map.swf", width:760, height:650, wmode:"transparent", quality:"high"}, {version:"7"});

	$('a.pop-up, li.pop-up a').click( function () {
	    var pLink = this.href;
		window.open(pLink,'PopUp','width=760,height=650, scrollbars=no')
		return false;
		});

	$('a#snow-controller').toggle ( function() {
		//alert($(this).parents);									 	
		$(this).parents('#snow-report').children('#snow-info').show();
		$(this).css("background-position","0 0");
	}, function() {
		$(this).parents('#snow-report').children('#snow-info').hide();
		$(this).css("background-position","0 -47px");
	});

	$('form.booking-form select#unit_type').change( function(){
		var data = $(this).val();

		if(data == 'deluxe') {
			$('input#roomlist1').val('VVK');
			$('input#roomlist2').val('VVQQ');
			$('input#roomlist3').val('FVQQ');
			$('input#roomlist4').val('FVK');
		} else if (data == 'fireplace') {
			$('input#roomlist1').val('2FFS');
			$('input#roomlist2').val('2VFS');
			$('input#roomlist3').val('FVDS');
			$('input#roomlist4').val('VVDS');
			$('input#roomlist5').val('FVFS');
			$('input#roomlist6').val('VVMS');
		} else if (data == 'penthouse') {
			$('input#roomlist1').val('JPH');
			$('input#roomlist2').val('VPH');
			$('input#roomlist3').val('2DPH');			
		}
	 });
	$('a#add-promo').toggle(function() {
		$('div#code-box').show();
		$(this).css('background-position', 'right 3px').parents('div#check-availability').addClass('check-long');
		return false; 
		}, function() { 
			$('div#code-box').hide();
			$(this).css('background-position', 'right bottom').parents('div#check-availability').removeClass('check-long'); 
			return false; 
		});
	
	
	$('body.home div#mast-container').flash({src:"flash/homepage-masthead.swf", width:589, height:388, wmode:"transparent", quality:"high"}, {version:"8"});


	$("div#resort-gallery").flash(
		{src:"flash/photo_gallery.swf",
		 width:826,
		 height:400,
		 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_resort.xml";
				htmlOptions.flashvars.xmlFile = "flash/xml/images_resort.xml";
				$(this).html($.fn.flash.transform(htmlOptions));
		}
	);

	$("div#weddings-gallery").flash(
		{src:"flash/photo_gallery.swf",
		 width:826,
		 height:400,
		 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_weddings.xml";
				htmlOptions.flashvars.xmlFile = "flash/xml/images_weddings.xml";
				$(this).html($.fn.flash.transform(htmlOptions));
		}
	);

	$(this).find("form#spa-res").each(function() {
		toggle( "massage" );
		toggle( "body" );
		toggle( "facials" );
		toggle( "salon" );
	});
});

function CloseWindow() {
	window.close();
}

function toggle( element ) {
	switch( element ) {
		case "massage":
			local_array = new Array();
			local_array[0] = "massage_filters_1";
			local_array[1] = "massage_filters_2";
			local_array[2] = "massage_filters_3";
			local_array[3] = "massage_filters_4";
			local_array[4] = "massage_filters_5";
			local_array[5] = "massage_filters_6";
			local_array[6] = "massage_filters_7";
			local_array[7] = "massage_filters_8";
			local_array[8] = "massage_filters_9";
			local_array[9] = "massage_filters_10";
			local_array[10] = "massage_filters_11";
			local_array[11] = "massage_filters_12";
			local_array[12] = "massage_time";
		break;
		case "body":
			local_array = new Array();
			local_array[0] = "body_filters_1";
			local_array[1] = "body_filters_2";
			local_array[2] = "body_filters_3";
			local_array[3] = "body_filters_4";
			local_array[4] = "body_filters_5";
			local_array[5] = "body_filters_6";
			local_array[6] = "body_filters_7";
			local_array[7] = "body_filters_8";
			local_array[8] = "body_filters_9";
			local_array[9] = "body_time";
		break;
		case "facials":
			local_array = new Array();
			local_array[0] = "facials_filters_1";
			local_array[1] = "facials_filters_2";
			local_array[2] = "facials_filters_3";
			local_array[3] = "facials_filters_4";
			local_array[4] = "facials_filters_5";
			local_array[5] = "facials_filters_6";
			local_array[6] = "facials_filters_7";
			local_array[7] = "facials_filters_8";
			local_array[8] = "facials_time";
		break;
		case "salon":
			local_array = new Array();
			local_array[0] = "salon_filters_1";
			local_array[1] = "salon_filters_2";
			local_array[2] = "salon_filters_3";
			local_array[3] = "salon_time";
		break;
	
	}

	if ( document.getElementById( element ).checked == false ) {
		for ( i = 0; i < local_array.length; i++ ) {
			document.getElementById( local_array[i] ).disabled = true;
		}
		document.getElementById( element + "_label" ).className = "required none";
	} else {
		for ( i = 0; i < local_array.length; i++ ) {
			document.getElementById( local_array[i] ).disabled = false;
		}
		document.getElementById( element + "_label" ).className = "required";
	}

}
