var $j = jQuery.noConflict();
function findReservation() {
	var offer = ""; 	// From ResNet. If using the default blank offer just leave the two quote marks
	var roomType = "000";   // change this to the first room type sequence in the offer used above or leave blank.
	var domain = "reservations.grcasinos.com";	// Example: res.greathotel.com  DO NOT include the https//

	// DO NOT EDIT BELOW HERE 
	var partition = $j("#reslocations").val();
	var month = $j("#findcheckinmonth").val();
	var date = $j("#findcheckinday").val();
	var year = $j("#findcheckinyear").val();
	var nights = $j("#resduration").val();
	var adults = $j("#adultcount").val();
	var children = $j("#childrencount").val();
	var myyear = year.substring(2,4)
	document.location.href = "https://"+domain+"/cgi-bin/lansaweb?procfun+rn+resnet+"+partition+"+funcparms+UP(A2560)%3A%3B"+offer+"%3B"+month+date+myyear+"%3B"+nights+"%3B"+adults+"%3B"+children+"%3B"+roomType+"%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3F";
//	alert ("https://"+domain+"/resnet/lansaweb?procfun+rn+resnet+"+partition+"+funcparms+UP(A2560)%3A%3B"+offer+"%3B"+month+date+myyear+"%3B"+nights+"%3B"+adults+"%3B"+children+"%3B"+roomType+"%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3F");
//	ALERT USED FOR PROOF AND TESTING OK TO REMOVE BY CLIENT

}
function evaluateSelectCheckin(objDate,strValue) {
	var objCheckinDate = new Date(strValue);
	$j("#findcheckinmonth").val(objCheckinDate.getMonth()+1);
	$j("#findcheckinday").val(objCheckinDate.getDate());
	$j("#findcheckinyear").val(objCheckinDate.getFullYear());
}
function evaluateSelectCheckout(objDate,strValue) {
	var objcheckoutDate = new Date(strValue);
	$j("#findcheckoutmonth").val(objcheckoutDate.getMonth()+1);
	$j("#findcheckoutday").val(objcheckoutDate.getDate());
	$j("#findcheckoutyear").val(objcheckoutDate.getFullYear());
}
var boolShowBooking = true;
var boolPngFix;
$j(document).ready(function() {
	$j(".expand-hotel-booking").click(function() {
		$j(this).blur();
		var strTempSRC = $j("img",this).attr("src");
		if (boolShowBooking) {
			$j("img",this).attr("src",strTempSRC.replace("open","close"));
			$j(".expand-hotel-booking-content").slideDown("fast");
		} else {
			$j("img",this).attr("src",strTempSRC.replace("close","open"));
			$j(".expand-hotel-booking-content").slideUp("fast");
		}
		delete strTempSRC;
		boolShowBooking = !boolShowBooking;
	});
	$j("#main-nav li li:first-child").each(function() {
		$j("a",this).addClass("first-item");
	});
	var objCheckinDate = new Date();
	$j("#findcheckinmonth").val(objCheckinDate.getMonth()+1);
	$j("#findcheckinday").val(objCheckinDate.getDate());
	$j("#findcheckinyear").val(objCheckinDate.getFullYear());
	$j("#findcheckoutmonth").val(objCheckinDate.getMonth()+1);
	$j("#findcheckoutday").val(objCheckinDate.getDate());
	$j("#findcheckoutyear").val(objCheckinDate.getFullYear());
	$j('#childrencount').calendar({
		triggerElement: '#date-pick-checkin',
		selectHandler: evaluateSelectCheckin,
		dateFormat: '%m/%d/%Y',
		minYear: 2011,
		maxYear: 2013
	});
	$j('#searchinput').calendar({
		triggerElement: '#date-pick-checkout',
		selectHandler: evaluateSelectCheckout,
		dateFormat: '%m/%d/%Y',
		minYear: 2011,
		maxYear: 2013
	});
	$j("#main-nav li:has(ul) img").each(function() {
		var strSRC = $j(this).attr("src").replace("-nonav","-nav");
		$j(this).attr("src",strSRC);
		delete strSRC;
	});
	if (($j.browser.msie) && ($j.browser.version < 7)) {
		$j(".pngfix").each(function() {
			var strCurSRC = $j(this).attr("src").replace(".png",".jpg");
			$j(this).attr("src",strCurSRC)
			delete strCurSRC;
		});
	}
	xOffset = 20;
	yOffset = 5;
	$j("img.tooltip").hover(function(e){
		this.t = $j(this).attr("alt");
		$j(this).attr("alt","");
		$j("body").append("<p id='tooltip'><span class='content'>"+ this.t +"</span></p>");
		$j("#tooltip").css("top",(e.pageY - xOffset) + "px").css("left",(e.pageX + yOffset) + "px").fadeIn("fast");
    },function(){
		$j(this).attr("alt",this.t);
		$j("#tooltip").remove();
  });
	$j("img.tooltip").mousemove(function(e){
		$j("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
	$j("#subNavCurPage ul > li a:first").addClass("top-level");

});
function fixContentPngs() {

}
var flashvars = {};
if (location.href.indexOf(".dev.risd") != -1) {
	flashvars.mlxmlpath = "/feed-read.asp?feedurl=http://mdoli.grcasinos.com/doli/Doli.xml";
	flashvars.hxmlpath = "/feed-read.asp?feedurl=http://hkdoli.grcasinos.com/hdoli/Doli.xml";
} else {
	flashvars.mlxmlpath = "http://" + document.domain + "/feed-read.asp?feedurl=http://mdoli.grcasinos.com/doli/Doli.xml";
	flashvars.hxmlpath = "http://" + document.domain + "/feed-read.asp?feedurl=http://hkdoli.grcasinos.com/hdoli/Doli.xml";
}
var params = {};
params.menu = "false";
params.wmode = "transparent";
var attributes = {};
swfobject.embedSWF(strFlashDir + "/win-storm-totals-alt.swf","win-storm-total-display","430","66","9.0.0",false,flashvars,params,attributes);
sfHover = function() {
	var sfEls = document.getElementById("main-nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
