$(function() {
	//Documentation located in special.docs.js
	
	//Sifr
	
	/*$('div#content-inner h1').sifr({ strSWF: 'flash/tradegothic-bold.swf', strColor: '#ffffff', strWmode: 'transparent', strCase: 'upper', strFlashVars: 'textalign=left&' },{ expressInstall: true });
	$('div#content-inner h2').sifr({ strSWF: 'flash/tradegothic-bold.swf', strColor: '#ffffff', strWmode: 'transparent', strCase: 'upper', strFlashVars: 'textalign=left&' },{ expressInstall: true });
	$('div#content-inner h3').sifr({ strSWF: 'flash/tradegothic-bold.swf', strColor: '#ffffff', strWmode: 'transparent', strCase: 'upper', strFlashVars: 'textalign=left&' },{ expressInstall: true });
	$('div#sec-nav-wrapper ul li a').sifr({ strSWF: 'flash/tradegothic-bold.swf', strColor: '#ffffff', strWmode: 'transparent', strCase: 'upper', strFlashVars: 'textalign=left&' },{ expressInstall: true });*/
	$('div.push-home-content h2').sifr({ strSWF: 'flash/tradegothic-bold.swf', strColor: '#ffffff', strWmode: 'transparent', strCase: 'upper', strFlashVars: 'textalign=left&' },{ expressInstall: true });
	
	//Booking Console
	$("a#console-toggle").click(function(){
		if ($('#booking-console').hasClass('console-deactive')) {
				$("#booking-console").show();
				$("#booking-console").addClass("console-active");
				$("#booking-console").removeClass("console-deactive");
				$("#console-toggle").addClass("active-toggle");
			}
		else if ($('#booking-console').hasClass('console-active')) {
				$("#booking-console").hide();
				$("#booking-console").addClass("console-deactive");
				$("#booking-console").removeClass("console-active");
				$("#console-toggle").removeClass("active-toggle");
			}
		return false;	
	});
	
	//Homepage push marketing
	$("#home-push-rotation").each(function(){
		var tOut;
			tOut = 4000;
		$('#home-push-rotation').after('<div id="home-push-rotation-nav">').cycle({ 
			fx:     'scrollHorz', 
			speed:  1000, 
			timeout: tOut, 
			pager:  '#home-push-rotation-nav',
			cleartype: true,
			cleartypeNoBg: true
		});
	});
	
	
		$("#home-push-rotation1").each(function(){
		var tOut;
			tOut = 8000;
		$('#home-push-rotation1').after('<div id="home-push-rotation-nav1">').cycle({ 
			fx:     'fade', 
			speed:  1000, 
			timeout: tOut, 
			pager:  '#home-push-rotation-nav1',
			cleartype: true,
			cleartypeNoBg: true
		});
	});
	
	
	$("select#promos").change (function() {
		var promo_type;								
		$("select#promos option:selected").each(function () {
			promo_type = $(this).val();
		  }); 									
		$("input.promo-switch").attr("id", promo_type).attr("name", promo_type);
	});
	
	$('#interior').each(function() {
		var interiorHeight = $(this).height();
		var minHeight = interiorHeight + 63;
		$('#box-bottom').css('min-height', minHeight);
	});
	
	$("#event-rfp").each(function(){
		$("#ceremony_attendees").hide();
		$("#ceremony_yes").change(function(){
			var a = $(this).val();
			if ( a == 'yes' ) {
				$("#ceremony_attendees").show();
			} else {
				$("#ceremony_attendees").hide();
			}
		});
		$("#ceremony_no").change(function(){
			var a = $(this).val();
			if ( a == 'no' ) {
				$("#ceremony_attendees").hide();
			} else {
				$("#ceremony_attendees").show();
			}
		});
		$("#reception_attendees").hide();
		$("#reception_yes").change(function(){
			var a = $(this).val();
			if ( a == 'yes' ) {
				$("#reception_attendees").show();
			} else {
				$("#reception_attendees").hide();
			}
		});
		$("#reception_no").change(function(){
			var a = $(this).val();
			if ( a == 'no' ) {
				$("#reception_attendees").hide();
			} else {
				$("#reception_attendees").show();
			}
		});
	});
	
	/* Golf Yardage / Rating table */
	$(".golf").each(function(){
		$(".golf .course-ratings table tbody tr td:first-child").width(107);
		$(".golf .course-ratings table tbody tr td:nth-child(2)").width(90);
	});
	
	
	/* epostcard photo gallery */
	$('#epostcard-gallery').each(function(){
		$(this).flash({
		swf:"flash/photo-gallery.swf",
		width:700,
		height:540, 
		params:{
			allowscriptaccess:"always",
			wmode:"transparent",
			flashvars:{
				xmlPath:'flash/xml/home-masthead.xml',
				langXML:"flash/xml/i18n/en_formLabels.xml",
				imagesXML:"flash/xml/images.xml",
				previewURL:"postcard-preview.php",
				gatewayURL:"flashservices/gateway.php",
				epostConfigXML:"flash/xml/epostConfig.xml"
			}
		}
		});
	});

        $(window).load(function() {
                $('#epostcard-gallery object').attr('id', 'test').attr('name', 'test');
                });
	
	/* Accommodations flash */
	$("#accommodations-flash").flash({
		swf:"flash/accommodations-finder.swf",
		width:700,
		height:512, 
		params:{
			allowscriptaccess:"always",
			wmode:"transparent",
			flashvars:{
				xmlPath:'flash/xml/accommodations-picker.xml'
			}
		}
	});
	
	$("#spring-sale-modal").each(function() {
		var springModalWidth = ($(window).width()-$(this).width())/2;
		$(this).css('left',springModalWidth);
		$(this).css('top','120px');
		$(this).jqm({closeClass:'spring-sale-close,'}).jqmShow();
	});
	
	//Help text
	$(".form-help").hide();
	$(".help-text").each( function() {
		var x = $(this);
		$("a.help-link", x).toggle( function() {
			$(".form-help", x).slideDown("slow");
		}, function () {
			$(".form-help", x).slideUp("slow");
		});
	}); 
	
	//Floorplan Lightboxes
	$('.floorplan-lightbox').each(function(){
		var triggerid = "trigger-"+$(this).attr('id');
		$(this).jqm({trigger: 'a#'+triggerid});
	});
	
});

