$(function(){
        
	$('#promo-slide .slide').cycle({
		fx: 'scrollHorz',
		speed: 'fast',
		timeout: 4000,
		speed: 1000, 
		delay: 500,                 
		cleartype: true,
		cleartypeNoBg: true,
		height: '175px',
		pause: true,
		pager: '#promo-slide ul.slide-pager',
		pagerAnchorBuilder: function(idx, slide)
		{
			return '<li><a href="#">' + slide + '</a></li>'; 
		}
	});


	$('.photo-gallery-btn').mouseenter(function() {
		$(this).animate({height:116});
	});

	$('.photo-gallery-btn').mouseleave(function() {
		$(this).animate({height:32});
	});
	
	var feed = new google.feeds.Feed("http://weather.yahooapis.com/forecastrss?w=12798354");
	feed.setResultFormat(google.feeds.Feed.XML_FORMAT);
	feed.load(function(result){
		if (!result.error) {
			var items = result.xmlDocument.getElementsByTagName("item");
			for (var i = 0; i < items.length; i++) {
				var weatherElement = google.feeds.getElementsByTagNameNS(items[i], "http://xml.weather.yahoo.com/ns/rss/1.0", "condition")[0];
				var tempF = $(weatherElement).attr("temp");
				var tempC = ((tempF-32)*5)/9;
				$(".weather p").html(Math.round(tempF)+"F/"+Math.round(tempC)+"C");
			}
		}
	});
	
});

function startCycle(){
	if($.browser.msie){
		if($(".letterbox-cycle var").length > 1 && $("body#photo-gallery").size()!=1){
			$('.letterbox-cycle img').remove();
			$('.letterbox-cycle').cycle({ 
				fx: 'fade',
				speed: 3000,
				timeout: 3000
			});
		}
	}else{
		if($(".letterbox-cycle canvas").length > 1 && $("body#photo-gallery").size()!=1){
			$('.letterbox-cycle img').hide();
			$('.letterbox-cycle').cycle({ 
				fx: 'fade',
				speed: 3000,
				timeout: 3000
			});
		}
	}
	
	if ( $("body#photo-gallery").length ) {
		startGalleryCycle();
	}
}
function openVRXFlashViewer(propertyId,templateId,width, height){
    var win = window.open('http://mediaserver.vrxstudios.com/flash/app/vrxflashpresentation.htm?id=' + propertyId +'&Template='+templateId+'&width='+width+'&height='+height,
	'VrxStudiosPopUp',
	'height=640,width=571,scrollbars=no,toolbar=no,menubar=no');
    win.focus();
}

function bookSubmit() {
	document.forms["omni_reservation_form"].action = "";
	if('' == $("#promotioncode").val()){
		document.forms["omni_reservation_form"].action = "https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=IQ&property=USAHW";
		document.forms["omni_reservation_form"].submit();
		$("#promotioncode").val("");
		} else {
		if ('B-DAY' == $("#promotioncode").val()) {
			document.forms["omni_reservation_form"].action = "https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=IQ&property=USAHW&promotioncode=B-DAY";
			document.forms["omni_reservation_form"].submit();
			$("#promotioncode").val("");
		} else if ('SPRING' == $("#promotioncode").val()) {
			document.forms["omni_reservation_form"].action = "https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=IQ&property=USAHW&promotioncode=SPRING";
			document.forms["omni_reservation_form"].submit();
			$("#promotioncode").val("");
		} else if ('KAM' == $("#promotioncode").val()) {
			document.forms["omni_reservation_form"].action = "https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=IQ&property=USAHW&promotioncode=KAM";
			document.forms["omni_reservation_form"].submit();
			$("#promotioncode").val("");
		} else {
			alert("Please input a valid Promo Code.");
		}
	}
}

