﻿// JScript File

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// Temporary variables to hold mouse x-y pos.s
var posX = 0
var posY = 0

function getRatesWidget()
{   	
	var partition = window.frames['hotelWidget'].document.GetRates.property.value;	
	var offer = ""; 	// if offer codes will be allowed, fill this
	var roomType = "010";   // change this to the first room type sequence in the offer used above or leave blank.
	var domain = "hotel-reservations.isleofcapricasinos.com";	

	// DO NOT EDIT BELOW HERE 
	var nights = window.frames['hotelWidget'].document.GetRates.nights.value;
	var adults = window.frames['hotelWidget'].document.GetRates.adults.value;
	var children = window.frames['hotelWidget'].document.GetRates.children.value;
	var bookdate = window.frames['hotelWidget'].document.GetRates.hotelMonth.value + "/" + window.frames['hotelWidget'].document.GetRates.hotelDay.value + "/" + window.frames['hotelWidget'].document.GetRates.hotelYear.value;

	var bookDateArray = bookdate.split("/");

	var hotelBookDate = bookDateArray[0] + bookDateArray[1] + bookDateArray[2].substring(2, 4);

	if (partition == "")
	{

		alert("Please select a property first.");
		return;

	}

	if (partition == "BLX" || partition == "BET" || partition == "WTL" || partition == "LCH" || partition == "BNV" || partition == "BHK")
	{

		offer = "PRV";

		var clientSegment = "09";
		
		document.location.href = "https://"+domain+"/cgi-bin/lansaweb?procfun+rn+resnet+"+partition+"+funcparms+UP(A2560)%3A%3B"+offer+"%3B"+hotelBookDate+"%3B"+nights+"%3B"+adults+"%3B"+children+"%3B"+roomType+"%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B"+clientSegment+"%3B%3F";


	} 
	else if (partition == "MRQ")
	{

		document.location.href = "http://marquette.isleofcapricasinos.com/hotel-areahotels.aspx";

	}
	else {

		document.location.href = "https://"+domain+"/cgi-bin/lansaweb?procfun+rn+resnet+"+partition+"+funcparms+UP(A2560)%3A%3B"+offer+"%3B"+hotelBookDate+"%3B"+nights+"%3B"+adults+"%3B"+children+"%3B"+roomType+"%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3B%3F";

	}

}

function prepopulateHotelForm(hotelFormID) {

    var hotelForm = document.getElementById(hotelFormID);
    
    var currentDate = new Date();
    
    var currentMonthValue = currentDate.getMonth() + 1;
    
    if (currentMonthValue < 10) {
    
        currentMonthValue = "0" + currentMonthValue;
        
    }
    
    var currentDayValue = currentDate.getDate();
    
    if (currentDayValue < 10) {
    
        currentDayValue = "0" + currentDayValue;
        
    }
    
    hotelForm.hotelMonth.value = currentMonthValue;
    hotelForm.hotelDay.value = currentDayValue;
    
    var year1 = document.createElement('option');
    year1.text = currentDate.getFullYear();
    year1.value = currentDate.getFullYear();
    
    try {
    
        hotelForm.hotelYear.add(year1, null);
        
    } catch (ex) {
        
        hotelForm.hotelYear.add(year1);
        
     }

    var year2 = document.createElement('option');
    year2.text = currentDate.getFullYear() + 1;
    year2.value = currentDate.getFullYear() + 1;
    
    try {
    
        hotelForm.hotelYear.add(year2, null);
        
    } catch (ex) {
        
        hotelForm.hotelYear.add(year2);
        
     }


}

function calendarIframe() {

document.getElementById('calendarIFrame').style.visibility = "visible";
document.getElementById('calendarIFrame').style.zIndex = "1000";

var browserVersion = navigator.appVersion;

if (browserVersion.indexOf('MSIE 6') > 0)
{

document.getElementById('calendarIFrame').style.top = posY + "px";

} else {

document.getElementById('calendarIFrame').style.top = posY + "px";

}

document.getElementById('calendarIFrame').style.left = posX + "px";

//window.frames['hotelWidget'].document.GetRates.bookdate.value='';

	document.getElementById('calendarIFrame').innerHTML = "<iframe SRC='/calendarND.aspx' WIDTH=\"375\" HEIGHT=\"145\" scrolling=\"no\" FRAMEBORDER=0 style=\"border: '1px solid'; zindex: 1000;\" allowtransparency=\"false\" id='calendarHolder'>Your browser does not support the iframe tag. Please consider upgrading your browser.</iframe>";

}

function calendarIframeMainPage() {

document.getElementById('calendarIFrame').style.visibility = "visible";
document.getElementById('calendarIFrame').style.zIndex = "1000";

var browserVersion = navigator.appVersion;

if (browserVersion.indexOf('MSIE 6') > 0)
{

document.getElementById('calendarIFrame').style.top = "80px";

} else {

document.getElementById('calendarIFrame').style.top = "60px";

}

document.getElementById('calendarIFrame').style.left = "100px";
window.frames['hotelWidget'].document.GetRates.bookdate.value='';

	document.getElementById('calendarIFrame').innerHTML = "<iframe SRC='/calendar.aspx' WIDTH=\"375\" HEIGHT=\"145\" scrolling=\"no\" FRAMEBORDER=0 style=\"border: '1px solid'; zindex: 1000;\" allowtransparency=\"false\" id='calendarHolder'>Your browser does not support the iframe tag. Please consider upgrading your browser.</iframe>";

}

function setDateField(month, day, year) {

	window.frames['hotelWidget'].document.GetRates.hotelMonth.value=month;
	window.frames['hotelWidget'].document.GetRates.hotelDay.value=day;
	window.frames['hotelWidget'].document.GetRates.hotelYear.value=year;
document.getElementById('calendarIFrame').style.visibility = "hidden";
document.getElementById('calendarIFrame').style.left = "-500px";
document.getElementById('calendarIFrame').style.top = "-500px";


}


function getPosition(e) {
    e = e || window.event;
    var cursor = {x:0, y:0};
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX + 
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY + 
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }

	posX=cursor.x;
	posY=cursor.y;

	return cursor;
}
