$(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.landing-property-content").animate({height: "toggle"}, 800 ).toggleClass("collapsed");
	
		$('div.landing-more a').click(function(e) {
			
			e.preventDefault();
			
			var target = $(this).parent().prev().children("div.landing-property-content");
			target.animate({height: "toggle"}, 800 ).toggleClass("collapsed");

			if(target.hasClass("collapsed")){
				$("a#hide-details").hide();
				$("a#view-details").show();
			}else{
				$("a#hide-details").show();
				$("a#view-details").hide();
			}
			
		});
	
		$("div#landing-signup-dropable").flash(
		{src:"flash/optinform.swf",
		 width:225,
		 height:200,
		 wmode:"transparent",
		 align:"top",
		 salign:"tl",
		 quality:"high"},
		 {version:"7"});
		 
		$("div#push-sign-up-primary-nav-listing").flash(
		{src:"form.swf",
		 width:258,
		 height:360,
		 wmode:"transparent",
		 align:"top",
		 salign:"tl",
		 quality:"high"},
		 {version:"7"});
		
		$("div#push-sign-up-listing").flash(
		{src:"form.swf",
		 width:258,
		 height:360,
		 wmode:"transparent",
		 align:"top",
		 salign:"tl",
		 quality:"high"},
		 {version:"7"});


		$("div#sign-up-reopening").flash(
		{src:"flash/maui_form_box.swf",
		 width:258,
		 height:270,
		 wmode:"transparent",
		 align:"top",
		 salign:"tl",
		 quality:"high"},
		 {version:"7"});
		
		$("div#rejuvenation-inset").flash(
		{src:"flash/maui_prince_inset.swf",
		 width:243,
		 height:228,
		 wmode:"transparent",
		 align:"top",
		 salign:"tl",
		 quality:"high"},
		 {version:"7"});
		
		$("div#rejuvenation-inset").flash(
		{src:"flash/home-masthead.swf",
		 width:760,
		 height:143,
		 wmode:"transparent",
		 align:"top",
		 salign:"tl",
		 quality:"high"},
		 {version:"7"});
		
		$("div#push-home-map").flash(
		{src:"flash/map-main.swf",
		 width:229,
		 height:150,
		 wmode:"transparent",
		 align:"top",
		 quality:"high"},
		 {version:"7"});		

		$("div#push-hbp-wrapper div#push-home-map").flash(
		{src:"flash/map-hapuna.swf",
		 width:229,
		 height:148,
		 wmode:"transparent",
		 align:"top",
		 quality:"high"},
		 {version:"7"});		

		$("div#push-hph-wrapper div#push-home-map").flash(
		{src:"flash/map-waikiki.swf",
		 width:229,
		 height:140,
		 wmode:"transparent",
		 align:"top",
		 quality:"high"},
		 {version:"7"});		


// 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 }
	);
	*/


// Adds hover class for IE and animation for drop down nav - remove if not needed
	/*
	$("ul#nav-primary li").hover(
        function(){ $("ul", this).fadeIn("fast"); }, 
        function() { } 
    );
    if (document.all) {
        $("ul#nav-primary li").hoverClass("over");
		$("ul#nav-primary li ul li").hoverClass("over");
    }
	*/

  $("div#special-offers-golf-flash div#golf-flash").flash(
		{src:"/flash/email-form.swf",
		 width:244,
		 height:410,
		 wmode:"transparent",
		 quality:"high"},
		 {version:"9"},
			function(htmlOptions) {
				htmlOptions.flashvars.submissionPath = '/email-flash-special-process.php';
				$(this).html($.fn.flash.transform(htmlOptions));				
		});
        
    $("div#kamaaina-flash-email-form").flash(
        {src:"/flash/email-form-PRH.swf",
         width:244,
         height:370,
         wmode:"transparent",
         quality:"high"},
         {version:"9"},
            function(htmlOptions) {
                htmlOptions.flashvars.submissionPath = '/email-flash-kamaaina-process.php';
                $(this).html($.fn.flash.transform(htmlOptions));                
        });	

	//window.resizeSwf = function( size ) {
//	    if ( window.console ) console.log( size )
//	} 

	var hapuna_lookID = 32;
	var waikiki_lookID = 32;
	var mauna_lookID = 36;
	var prince_lookID = 35;
	
	$('form#reservations-console #propertyCode').each(function (i) {
			switch ($(this).val()) {
				case "061231": //This is Hapuna Beach
					$("div#occ-copy p").html("*Number of persons per room: maximum of 2 adults and 2 children (age 17 and under) or 3 adults");					
					break;
				case "061215": //This is Mauna Beach
					$("div#occ-copy p").html("*Number of persons per room: maximum of 2 adults and 1 child (age 17 and under) or 3 adults");
					break;
				case "061214": //This is Prince Beach
					$("div#occ-copy p").html("*Number of persons per room: maximum of 2 adults and 2 children (age 17 and under) or 3 adults");
					break;	
				case "": 
					$("div#occ-copy p").html("");
					break;	
			}

	});

			
	
	
	$("#propertyCode").change(
		function(){		
			switch ($(this).val()) {
				case "061231": //This is Hapuna Beach
					$("#lookAndFeelId").val("32");
					$("#operation").val("SinglePropertySearchResult");
					$("div#occ-copy p").html("*Number of persons per room: maximum of 2 adults and 2 children (age 17 and under) or 3 adults");					
					break;
				case "061212": //This is Waikiki Beach
					$("#lookAndFeelId").val("34");
					$("#operation").val("SinglePropertySearchResult");
					break;
				case "061215": //This is Mauna Beach
					$("#lookAndFeelId").val("36");
					$("#operation").val("SinglePropertySearchResult");					
					$("div#occ-copy p").html("*Number of persons per room: maximum of 2 adults and 1 child (age 17 and under) or 3 adults");
					break;
				case "061214": //This is Prince Beach
					$("#lookAndFeelId").val("35");
					$("#operation").val("SinglePropertySearchResult");	
					$("div#occ-copy p").html("*Number of persons per room: maximum of 2 adults and 2 children (age 17 and under) or 3 adults");
					break;	
				case "": 
					$("div#occ-copy p").html("");
					break;	
			}
		}
	);
	
	$("a.expand").click(function(e){
		e.preventDefault();
		if ($(this).hasClass('active')) {
			$("div#code-box").slideUp("slow");
			$(this).removeClass("active");
		} else {			
			$("div#code-box").slideDown("slow");
			$(this).addClass("active");
		}
		return false;
	});
/*

	$("a.expand").toggle(function(){
		// $("div#code-box").slideToggle("slow");
		//alert("here");
		//$("div#code-box").show("slow");
		$(this).addClass("active");
		alert($(this).attr('class'));
		return false;
	}, function() {
		$("div#code-box").show("hide");
		$(this).removeClass("active");
		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); }
		);
	});

};   

function resizeSwf(size) {
    $('div#kamaaina-flash-email-form').css('height',size+'px');
    $('div#special-offers-golf-flash').css('height',size+'px');
    //alert(size);
}
