



function submitViaEnter(pEvent, pForm) 
{
if (pEvent.keyCode == 13) 
{
pForm.submit();
}
}


function OpenPopupWindow(pBodyUri, pWindowTitle, pScrollOption, pFrameOption, pWidth, pHeight, pResizable)
{

var undefined = void 0; 
var lWidth = (pWidth == undefined) ? 351 : pWidth;
var lHeight = (pHeight == undefined) ? 275 : pHeight;
var lResizable = (pResizable == undefined) ? "no" : pResizable;
var lProtocol = document.location.protocol;
var lWindowOptions = "width=" + lWidth + ",height=" + lHeight + ",toolbar=no,menubar=no,scrollbars=no,resizable=" + lResizable;
var lPopupPath = (lProtocol == "https:" && pFrameOption == "N") ? "/common/secure/popup.jsp" : "/common/popup.jsp";
var lWindowPath = lPopupPath + "?bodyUri=" + escape(pBodyUri) + "&title=" + escape(pWindowTitle) + "&scroll=" + pScrollOption + "&frames=" + pFrameOption;
var lWindowName = "";
for (i=0; i<pWindowTitle.length; i++)
{
var lChar = pWindowTitle.charAt(i);
if (lChar != ' ' && lChar != '-' && lChar != '&')
{
lWindowName += lChar;
}
}
var lWindowTitle = pWindowTitle;
window.open(lWindowPath, lWindowName, lWindowOptions);
}


function OpenGenericPopupWindow(pBodyUri, pWindowTitle, pScrollOption, pFrameOption, pWidth, pHeight, pResizable)
{

var undefined = void 0;
var lWidth = (pWidth == undefined) ? 351 : pWidth;
var lHeight = (pHeight == undefined) ? 275 : pHeight;
var lResizable = (pResizable == undefined) ? "no" : pResizable;
var lProtocol = document.location.protocol;
var lWindowOptions = "width=" + lWidth + ",height=" + lHeight + ",toolbar=no,menubar=no,scrollbars=no,resizable=" + lResizable;
var lPopupPath = (lProtocol == "https:" && pFrameOption == "N") ? "/common/secure/genericpopup.jsp" : "/common/genericpopup.jsp";
var lWindowPath = lPopupPath + "?bodyUri=" + escape(pBodyUri) + "&title=" + escape(pWindowTitle) + "&scroll=" + pScrollOption + "&frames=" + pFrameOption;
var lWindowName = "";
for (i=0;i<pWindowTitle.length;i++)
{
var lChar = pWindowTitle.charAt(i);
if (lChar != ' ' && lChar != '-' && lChar != '&')
{
lWindowName += lChar;
}
}
var lWindowTitle = pWindowTitle;
window.open(lWindowPath, lWindowName, lWindowOptions).focus();
}

var sPanelName = '';

function hidePanelPopup()
{ 
$(sPanelName).style.display = 'none';
sPanelName = '';
}








function showPanelPopup(pPanelName, pXPos, pYPos)
{
var lPanel = $(pPanelName);
var lXPos = (pXPos) ? pXPos : 300;
var lYPos = (pYPos) ? pYPos : 300;
var lScrollAmount = document.body.scrollTop;

lYPos = (lYPos + lScrollAmount);

lPanel.style.position = 'absolute';
lPanel.style.left = lXPos;
lPanel.style.top = lYPos;
lPanel.style.display = 'block';
sPanelName = pPanelName;
}

function OpenHotelMap (pBrandUrl, pHotelCode)
{
var lWindowOptions = "width=800,height=550,toolbar=no,menubar=no,scrollbars=yes,resizable=yes";
var lWindowPath = "http://" + pBrandUrl + "/hoteldirectory/nav/map.jsp?hotelcode=" + pHotelCode + "&type=hotel.map";
window.open(lWindowPath, "Map", lWindowOptions);
}

function OpenDynamicMap (pHotelCode, pHotelBrandCode)
{
var lWindowOptions = "width=800,height=550,toolbar=no,menubar=no,scrollbars=yes,resizable=yes";
var lWindowPath = "/hoteldirectory/nav/map.jsp?hotelcode=" + pHotelCode + "&hotelBrandCode=" + pHotelBrandCode + "&type=hotel.map";
window.open(lWindowPath, "Map", lWindowOptions);
}

function OpenStaticMap (pHotelImage)
{
var lWindowOptions = "width=800,height=550,toolbar=no,menubar=no,scrollbars=yes,resizable=yes";
window.open(pHotelImage, "Map", lWindowOptions);
}

function OpenCityMap (pCity, pState, pCountry, pShowCrossBrandMap)
{
var lWindowOptions = "width=600,height=528,toolbar=no,menubar=no,scrollbars=yes,resizable=yes";
var lWindowPath = "/hoteldirectory/nav/map.jsp?type=city.map&city=" + pCity + "&state=" + pState + "&country=" + pCountry;
if (pShowCrossBrandMap)
{
lWindowPath += "&crossbrand=true";
}
window.open(lWindowPath, "Map", lWindowOptions);
}

function popEmail(pPageLink)
{
pPageLink = encodeURIComponent(pPageLink);
window.open("/popupemailafriend.do?title=Email+a+Friend&pageLink="+pPageLink, 'email', 'dependent, toolbar=no,width=400,height=597').focus();
}

function goToLink(pSelect)
{
if (pSelect[pSelect.selectedIndex].value.substring(0, 4) == "http")
{
window.open(pSelect[pSelect.selectedIndex].value,'_blank');
}
else if (pSelect[pSelect.selectedIndex].value.substring(0, 3) == "www")
{
window.open("http://" + pSelect[pSelect.selectedIndex].value, '_top');
}
else
{
window.open(pSelect[pSelect.selectedIndex].value, '_top');
}
}

function handleLanguageChange(pEnglish)
{
var lLanguageOptions = document.localeform.language.options;
var lSelectedOption = lLanguageOptions[lLanguageOptions.selectedIndex];
if (lSelectedOption.value == pEnglish)
{
document.localeform.onlyTranslatedPromos.value = 'true';
document.localeform.submit();
}
else
{
var langWin = window.open('/language/promo/options.do?language=' + lSelectedOption.value, 'languageoptions','width=400,height=300,scrollbars=1');
langWin.focus();
}
}

function submitLanguageOptions()
{
window.close();
if (opener && !opener.closed)
{
var lLocaleForm = opener.document.localeform;
var lPromoVisibility = window.document.optionsForm.promoVisibility;

lLocaleForm.onlyTranslatedPromos.value = (lPromoVisibility[1].checked) ? 'true' : 'false';
lLocaleForm.submit();
}
}

function assignCountryCode(pCountryCode, pCountryPrefix)
{
if (pCountryCode.value == '')
{
pCountryPrefix.value = '';
}
else
{
pCountryPrefix.value = countryCodes[pCountryCode.value];
}
pCountryCode.focus();
}

function RemoveInvalidPostalCodeCharacters(pPostalCode, pCountry)
{

var lValidUsMxChar = /[0-9]/;

var lValidOtherChar = /[a-zA-Z0-9]/;
var lCounter;
var lPostalCode = "";

if (pPostalCode != "")
{
for (lCounter = 0; lCounter < pPostalCode.length; lCounter++)
{
lTemp = pPostalCode.charAt(lCounter);

if (pCountry == "US" || pCountry == "MX")
{
if (lValidUsMxChar.test(lTemp))
{
lPostalCode += lTemp;
}
}
else
{
if (lValidOtherChar.test(lTemp))
{
lPostalCode += lTemp;
}
}
}
}

return lPostalCode;
}

function RemoveInvalidPhoneCharacters(pNumber)
{
var lValidChars = "0123456789";
var lCounter;
var lValidNumber = "";

if (pNumber != "")
{
for (lCounter=0; lCounter < pNumber.length; lCounter++)
{
lTemp = pNumber.charAt(lCounter);
if (lValidChars.indexOf(lTemp) != "-1")
{
lValidNumber += lTemp;
}
}
}

return lValidNumber;
}

function IsValidateEmailConstruction(pEmail)
{
var validEmail = false;
var filter= /^([a-zA-Z0-9_\.\-\'])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(pEmail))
{
validEmail = true;
}

return(validEmail);
}

function isAllDigit(pStr)
{
if (pStr.value != "")
{
for (i = 0; i < pStr.length; i++)
{
if (!isDigit(pStr.charAt(i)))
{
return false;
}
}
return true;
}
return false;
}


function getCookie(pName)
{
var start = document.cookie.indexOf(pName + "=");
var len = start + pName.length + 1;
if (!start && pName != document.cookie.substring(0, pName.length ))
{
return null;
}
if (start == -1)
{
return null;
}
var end = document.cookie.indexOf(";", len);
if (end == -1)
{
end = document.cookie.length;
}
return unescape(document.cookie.substring(len, end));
}

function setCookie(pName, pValue, pExpires, pPath) 
{

var today = new Date();
today.setTime(today.getTime());
var expires_date = new Date( today.getTime() + pExpires);

document.cookie = pName + "=" + escape(pValue) +
(pExpires ? ";expires=" + expires_date.toGMTString() : "") + 
(pPath ? ";path=" + pPath : "");
}

/**/ 


function isValidDate(pDate)
{
var lLength = pDate.length;
var lMilliseconds = Date.parse(pDate);

if ((lLength != 10) && (isNaN(lMilliseconds)))
{
return false;
}

return true;
}

function handleArriveChanged(pArriveField, pDepartField)
{
var lArriveValid = isValidDate(pArriveField.value);
var lDepartValid = isValidDate(pDepartField.value);

if (lArriveValid && lDepartValid)
{
var lArriveMillis = Date.parse(pArriveField.value);
var lDepartMillis = Date.parse(pDepartField.value);

if (lArriveMillis > lDepartMillis)
{
pDepartField.value = "";
}
}
}

function handleDepartChanged(pArriveField, pDepartField)
{
var lArriveValid = isValidDate(pArriveField.value);
var lDepartValid = isValidDate(pDepartField.value);

if (lArriveValid && lDepartValid)
{
var lArriveMillis = Date.parse(pArriveField.value);
var lDepartMillis = Date.parse(pDepartField.value);

if (lDepartMillis < lArriveMillis)
{
pArriveField.value = "";
}
}
}





function submitResForm(pConfNo, pResNo, pHotelBrandCode, pSubmitAction)
{
document.myAccountForm.confNo.value = pConfNo;
document.myAccountForm.resNo.value = pResNo;
document.myAccountForm.submitAction.value = pSubmitAction;
document.myAccountForm.hotelBrandCode.value = pHotelBrandCode; 

document.myAccountForm.action = "/myaccount/secure/myReservationsAction.do";

document.myAccountForm.submit(); 
}

function checkin(pConfNo, pResNo, pBrandVariantCode, pCheckInUrl)
{
if (pCheckInUrl == "")
{
submitResForm(pConfNo, pResNo, pBrandVariantCode, 'checkin');
}
else
{
document.location = pCheckInUrl;
}
}

function editReservation(pConfNo, pResNo, pHotelBrandCode)
{
submitResForm(pConfNo, pResNo, pHotelBrandCode, "edit");
}

function cancelReservation(pConfNo, pResNo, pHotelBrandCode)
{
submitResForm(pConfNo, pResNo, pHotelBrandCode, "cancel");
}

function confirmDeleteHotel(pHotelID, pPanelName)
{
showPanelPopup(pPanelName, 350, 300);

document.myAccountForm.submitAction.value = "delete";
document.myAccountForm.hotelID.value = pHotelID;
}

function deleteHotel()
{
document.myAccountForm.action = "/myaccount/secure/myFavoriteHotelAction.do";
document.myAccountForm.submit();
}

function printReceipt(pResNo)
{
var lLink = "/myaccount/secure/printReceipt.do?action=print&resNo=" + pResNo;
window.open(lLink, "", "width=620, height=600, left=0, top=0, menubar=no, status=yes, location=no, toolbar=no, scrollbars=yes, resizable=no");
}

function HandleEYCancel()
{
document.eyPreferencesForm.action.value="cancel";
document.eyPreferencesForm.submit();
} 

function switchTab(pBrand)
{
$('tabRAD').className = 'inactive';
$('tabCHI').className = 'inactive';
$('tabPII').className = 'inactive';
$('tabPKP').className = 'inactive';
$('panelRAD').className = 'inactivePanel';
$('panelCHI').className = 'inactivePanel';
$('panelPII').className = 'inactivePanel';
$('panelPKP').className = 'inactivePanel';

$('tab' + pBrand).className = 'active';
$('panel' + pBrand).className = 'activePanel';
}

function updateMyNewsletterForm()
{
var lForm = document.myNewsletterForm;
lForm.submitAction.value="update";
lForm.submit();
}

function updateMyInterestsForm()
{
var lForm = document.myInterestForm;
lForm.submitAction.value="update";
lForm.submit();
}




function handlePasswordKeypress(pEvent)
{
var lEvent = (pEvent) ? pEvent : event;
var lCharCode = (lEvent.charCode) ? lEvent.charCode : ((lEvent.which) ? lEvent.which : lEvent.keyCode);
if (lCharCode == 13 || lCharCode == 3)
{
document.loginForm.submit();
return false;
}
return true;
}

function handleConfOrCCKeypress(pEvent, pForm)
{
var lEvent = (pEvent) ? pEvent : event;
var lCharCode = (lEvent.charCode) ? lEvent.charCode : ((lEvent.which) ? lEvent.which : lEvent.keyCode);
if (lCharCode == 13 || lCharCode == 3)
{
pForm.submit();
return false;
}
return true;
}





function toggleShuttleSelection(pEnabled)
{
var lForm = document.checkInForm;
if (pEnabled == 'true')
{
lForm.shuttleUni.disabled = false;
lForm.shuttleUni.className = '';
lForm.airlineName.disabled = false;
lForm.airlineName.className = '';
lForm.flightNumber.disabled = false;
lForm.flightNumber.className = '';
}
else
{
lForm.shuttleUni.disabled = true;
lForm.shuttleUni.className = 'disabled';
lForm.airlineName.disabled = true;
lForm.airlineName.className = 'disabled';
lForm.flightNumber.disabled = true;
lForm.flightNumber.className = 'disabled';
} 
} 

function toggleParkingSelection(pEnabled)
{
var lForm = document.checkInForm; 
if (pEnabled == 'true')
{
lForm.vehicleType.disabled = false;
lForm.vehicleType.className = '';
lForm.vehicleType.options[1].selected = true;
if (lForm.parkingType)
{
lForm.parkingType.disabled = false;
lForm.parkingType.className = '';
}
}
else
{
lForm.vehicleType.disabled = true;
lForm.vehicleType.className = 'disabled';
lForm.vehicleType.options[0].selected = true;
if (lForm.parkingType)
{
lForm.parkingType.disabled = true;
lForm.parkingType.className = 'disabled';
lForm.parkingType.options[0].selected = true;
}
} 
}

function autoSelectWakeUpCall()
{
document.checkInForm.wakeUpCall.checked = true;
}

function setWakeUpCallTime(pFormField)
{
var lValidMinuteDelimiters = new Array(" ", ":", ",", "-", "/", ".", ";", "|");
var lTimeString = pFormField.value;
var lHours = lTimeString;
var lMinutes = "00";

for (var i = 0; i < lValidMinuteDelimiters.length; i++)
{
var lIndex = lTimeString.indexOf(lValidMinuteDelimiters[i]);

if (lIndex > 0)
{
lHours = lTimeString.substring(0, lIndex);
lMinutes = lTimeString.substring(lIndex + 1, lTimeString.length);

if (lMinutes == "")
{
lMinutes = "00";
}
else if (lMinutes.length < 2)
{
lMinutes = "0" + lMinutes;
}

break;
}
}


if (lHours == lTimeString)
{

if (lTimeString.length == 3)
{
lHours = lTimeString.substring(0, 1);
lMinutes = lTimeString.substring(1,3);
}

else if (lTimeString.length == 4)
{
lHours = lTimeString.substring(0, 2);
lMinutes = lTimeString.substring(2, 4);
}
}

var lValidTimeString = lHours + ":" + lMinutes;
var lTime = new Date("3/20/1963 " + lValidTimeString);

pFormField.value = lValidTimeString;
return true;
}

function performCheckin()
{
if (document.checkInForm.wakeUpCall.checked)
{
setWakeUpCallTime(document.checkInForm.wakeUpCallTime);
}
document.getElementById("checkinButtons").style.visibility='hidden';
document.checkInForm.submit();
}

function cancelEnrollment()
{
document.createAccountForm.action.value = "cancel";
document.createAccountForm.submit();
}

function createAccount()
{
var lForm = document.createAccountForm;

if (lForm.postal)
{
lForm.postal.value = RemoveInvalidPostalCodeCharacters(lForm.postal.value, lForm.country.options[lForm.country.selectedIndex].value);
}
if (lForm.countryPrefix)
{
lForm.countryPrefix.value = RemoveInvalidPhoneCharacters(lForm.countryPrefix.value);
}
if (lForm.areaCode)
{
lForm.areaCode.value = RemoveInvalidPhoneCharacters(lForm.areaCode.value);
}
if (lForm.phoneNumber)
{
lForm.phoneNumber.value = RemoveInvalidPhoneCharacters(lForm.phoneNumber.value);
}
if (lForm.GPNumber)
{
lForm.GPNumber.value = RemoveInvalidPhoneCharacters(lForm.GPNumber.value);
}

if (!isDblClick())
{
document.createAccountForm.submit();
}
}




var lLastClickDate;
function isDblClick()
{
var lStatus = false;
var lThisClickDate = new Date();

if (lLastClickDate != null)
{
if ((lThisClickDate.getTime() - lLastClickDate.getTime()) < 2000)
{
lStatus = true;
}
}

lLastClickDate = lThisClickDate;

return lStatus;
}

function goToFooterLink(pSelect)
{
var lUrl = pSelect[pSelect.selectedIndex].value;
var lTarget = "_blank";

if (lUrl.indexOf("crossBrandEntry") > 0)
{
lTarget = "_top";
}

if (lUrl.substring(0,4) == "http")
{
window.open(lUrl, lTarget);
}
else if (lUrl.substring(0,3) == "www")
{
window.open("http://" + lUrl, lTarget);
}
else
{
window.open(lUrl, lTarget);
}
}

function handleCarlsonSiteSelect()
{
var lSiteOptions = document.carlsonSiteSelectForm.carlsonSiteSelect.options;
var lSelectedOption = lSiteOptions[lSiteOptions.selectedIndex];
if (lSelectedOption.value)
{
goToFooterLink(lSiteOptions);
}
}

function moreOptions(pForm, pActionPath)
{
var lForm = document.forms[pForm];
lForm.action = pActionPath;
lForm.submit();
}

function changeCountry()
{
var lForm = document.hotelSearchForm;
if (lForm.country.value != "" &&
lForm.country.value != "US" &&
lForm.country.value != "CA" &&
lForm.country.value != "MX")
{
document.getElementById("stateprovince").style.display = "none";
document.getElementById("stateprovincelabel").style.display = "none";
}
else
{
document.getElementById("stateprovince").style.display = "";
document.getElementById("stateprovincelabel").style.display = "";
}
}

function toggleTabHighlight(pTabId, pInitialClassName)
{
if (pInitialClassName == "inactivetab")
{
var lClassName = document.getElementById(pTabId).className;

if (lClassName == pInitialClassName)
{
document.getElementById(pTabId).className = "activetab";
}
else
{
document.getElementById(pTabId).className = pInitialClassName;
}
}
}




function showAllPromos()
{
document.localeform.onlyTranslatedPromos.value = "false";
document.localeform.submit();
}




function switchTabs(pSelectedElement, pEyFlag, pSetGppPromo)
{
if (pSelectedElement == "fah")
{
Element.show("fah");
Element.hide("res");

$("fahtd").className = "selected";
$("fahtd2").className = "selected";
$("vwrestd").className = "unselected";
$("vwrestd2").className = "";
if (pEyFlag == true)
{
if (pSetGppPromo == undefined)
{
Element.hide("ey");
}
$("eytd").className = "unselected";
$("eytd2").className = "";
}
}
if (pSelectedElement == "ey")
{
if (pSetGppPromo == true)
{
Element.show("fah");
Element.hide("res");
$("promotionalCode").value = "redeemgp";
}
else
{
Element.hide("fah");
Element.show("ey");
Element.hide("res");
$("promotionalCode").value = "";
document.eyBorgResForm.firstName.focus();
}

$("eytd").className = "selected";
$("fahtd").className = "unselected";
$("vwrestd").className = "unselected";
$("eytd2").className = "selected";
$("fahtd2").className = "";
$("vwrestd2").className = "";
}
if (pSelectedElement == "res")
{
Element.hide("fah");
Element.show("res");

$("vwrestd").className = "selected";
$("fahtd").className = "unselected";
$("vwrestd2").className = "selected";
$("fahtd2").className = "";
if (pEyFlag == true)
{
if (pSetGppPromo == undefined)
{
Element.hide("ey");
}
$("eytd").className = "unselected";
$("eytd2").className = "";
}
document.itinerarySearchForm.firstName.focus();
}
}




totalRooms = 9;
roomPrefix = "room";
function changeRooms(pNumRooms)
{
roomsSelected = new Number(pNumRooms.value);
for (i = 1; i <= totalRooms; i++)
{
if (i <= roomsSelected)
{
document.getElementById(roomPrefix + i).style.display = "";
}
else
{
document.getElementById(roomPrefix + i).style.display = "none";
}
}
}




function selectGuaranteeMethod()
{
var lForm = document.guestInfoForm;
var lSelectedMethod = lForm.deposit.options[lForm.deposit.selectedIndex].value;

lForm.cardType.selectedIndex = 0;
lForm.cardNumber.value = "";
lForm.cardExpireMonth.selectedIndex = 0;
lForm.cardExpireYear.selectedIndex = 0;
lForm.updateCards.checked = false;

if (lSelectedMethod == "CO")
{
lForm.cardType.disabled = true;
lForm.cardNumber.disabled = true;
lForm.cardExpireMonth.disabled = true;
lForm.cardExpireYear.disabled = true;
lForm.updateCards.disabled = true;

if (lForm.cardType.style)
{ 

lForm.cardType.style.backgroundColor="#cccccc";
lForm.cardNumber.style.backgroundColor="#cccccc";
lForm.cardExpireMonth.style.backgroundColor="#cccccc";
lForm.cardExpireYear.style.backgroundColor="#cccccc";
lForm.updateCards.style.backgroundColor="#cccccc";
}
}
else
{
lForm.cardType.disabled = false;
lForm.cardNumber.disabled = false;
lForm.cardExpireMonth.disabled = false;
lForm.cardExpireYear.disabled = false;
lForm.updateCards.disabled = false;

if (lForm.cardType.style)
{

lForm.cardType.style.backgroundColor="#ffffff";
lForm.cardNumber.style.backgroundColor="#ffffff";
lForm.cardExpireMonth.style.backgroundColor="#ffffff";
lForm.cardExpireYear.style.backgroundColor="#ffffff";
lForm.updateCards.style.backgroundColor="#ffffff";
}


for (ii=0; ii < lForm.cardType.length; ii++)
{
if (lForm.cardType.options[ii].defaultSelected)
{
lForm.cardType.selectedIndex = ii;
break;
}
}

lForm.cardNumber.value = lForm.cardNumber.defaultValue;

for (ii=0; ii < lForm.cardExpireMonth.length; ii++)
{
if (lForm.cardExpireMonth.options[ii].defaultSelected)
{
lForm.cardExpireMonth.selectedIndex = ii;
break;
}
}

for (ii=0; ii < lForm.cardExpireYear.length; ii++)
{
if (lForm.cardExpireYear.options[ii].defaultSelected)
{
lForm.cardExpireYear.selectedIndex = ii;
break;
}
}
}
}

function handleMoreOptionsLink(pFormName,pOptions)
{
var lForward="/reservation/displayMoreSearchOptions.do";
if (pOptions != null) 
{
lForward = lForward+"?"+pOptions;
}
$(pFormName).action=lForward;
$(pFormName).submit();
}

function handleOtherLocationsSearch()
{
if ($F('rateSearchHotelCode') == "search-other") 
{
var lForm = $('rateSearchForm');
lForm.action ='/reservation/displayMoreSearchOptions.do?forcedCitySearch=true';
$('rateSearchHotelCode').value = "";
$('rateSearchForm').submit();
}
}

function submitCityRateSearchForm(pShowInterimSearchPage)
{

$('cityRateSearchForm').submit();
if (pShowInterimSearchPage)
{
document.getElementById("bodydiv").style.display = "none";
document.getElementById("waitdiv").style.display = "";
document.getElementsByTagName("body")[0].className = "waitpage";
}
}

function submitRateSearchForm(pShowInterimSearchPage)
{
if ($F('rateSearchHotelCode') == "search-london") 
{
var lForm = $('rateSearchForm');
lForm.action = '/reservation/cityRateSearch.do';
lForm['citySearchForm.city'].value = 'london';
lForm['citySearchForm.country'].value = 'GB';
}


$('rateSearchForm').submit();
if (pShowInterimSearchPage)
{
document.getElementById("bodydiv").style.display = "none";
document.getElementById("waitdiv").style.display = "";
document.getElementsByTagName("body")[0].className = "waitpage";
}
}





function processSideItinForm()
{
if (document.resInfoForm.numberAdults)
{
var lNumAdults = document.resInfoForm.numberAdults.options[document.resInfoForm.numberAdults.selectedIndex].value;
if (parseInt(lNumAdults) == 0)
{
lNumAdults = 1;
document.resInfoForm.numberAdults.options[1].selected = true;
}
}

document.resInfoForm.submit();
}

function changeImage(pNewImage)
{
document.mainImage.src = pNewImage;
}

function makeReservation()
{
window.setTimeout("window.parent.close();", 500);
document.makeResEntranceForm.submit();
}





function brandChange()
{
document.brandForm.submit();
return true;
}

function returnHotelCode(pHotlcode)
{
parent.opener.document.resLookupForm.hotelCode.value = pHotlcode;
parent.close();
}

function returnPCRNumber(pCorpid)
{
parent.opener.document.hotelSearchForm.corporateAccountID.value = pCorpid;
parent.close();
}





function omnitureCustomLink(pBrandName, pSuiteId)
{
s_linkType='o';
s_linkName='Referral to ' + pBrandName;
s_eVar9=pBrandName;
s_lnk=s_co(this);
s_gs(pSuiteId);
}





function changeEventResDate (pFormObj)
{
var intEventSelected, intEventDate, intArriveSelected, intDepartSelected, intArriveDate, intDepartDate, intArriveMonth, intDepartMonth;
var strEventMonth, strDepartMonth, strMonth, strYear, intCount;

intEventSelected = pFormObj.eventDay.selectedIndex;
intEventDate = pFormObj.eventDay[intEventSelected].value;
intArriveSelected = pFormObj.checkinDay.selectedIndex;
intArriveDate = pFormObj.checkinDay[intArriveSelected].value;
intDepartSelected = pFormObj.checkoutDay.selectedIndex;
intDepartDate = pFormObj.checkoutDay[intDepartSelected].value;

if (intEventDate != "")
{
if (intArriveDate != intEventDate)
{
intArriveDate = intEventDate;
}
if (intDepartDate <= intArriveDate)
{
intDepartDate = intArriveDate;
intDepartDate++;
}

intEventSelected = pFormObj.eventMonthYear.selectedIndex;
strEventMonth = pFormObj.eventMonthYear[intEventSelected].value;


if (strEventMonth.length == 8)
{
strMonth = strEventMonth.substring(0, 3);
intArriveYear = strEventMonth.substring(4, 8);

for (intCount = 0; intCount < 12; intCount++)
{
if (strMonth == strMonthArray[intCount])
{
intArriveMonth = intCount;
}
}
}

intDepartMonth = intArriveMonth;
intDepartYear = intArriveYear;


if (intDepartDate > intDaysArray[intArriveMonth])
{
intDepartDate = 1;
intDepartMonth++;

if (intDepartMonth > 11)
{
intDepartMonth = 0;
intDepartYear++;
}
}


pFormObj.checkinDay[intArriveDate].selected = true;
strMonthDisplay = strMonthArray[intArriveMonth] + " " + intArriveYear;
for (intCount = 0; intCount < pFormObj.checkinMonthYear.options.length; intCount++)
{
if (strMonthDisplay == pFormObj.checkinMonthYear[intCount].value)
{
pFormObj.checkinMonthYear[intCount].selected = true;
}
}

pFormObj.checkoutDay[intDepartDate].selected = true;
strMonthDisplay = strMonthArray[intDepartMonth] + " " + intDepartYear;
for (intCount = 0; intCount < pFormObj.checkoutMonthYear.options.length; intCount++)
{
if (strMonthDisplay == pFormObj.checkoutMonthYear[intCount].value)
{
pFormObj.checkoutMonthYear[intCount].selected = true;
}
}
}

return;
}





function handleHotelCodeChange(pSelectObject)
{
var lSelectedOption = pSelectObject[pSelectObject.selectedIndex];

if (lSelectedOption.value == 'other-locations')
{
window.location='/reservation/clearReservation.do?allowCitySearch=true';
}
else if (lSelectedOption.value == 'search-london')
{
window.location='/reservation/clearReservation.do?allowCitySearch=true&city=London';
}
}





function changeDepartDate (formObj)
{
var intSelected, intDepartSelected, intArriveDate, intDepartDate, intArriveMonth, intDepartMonth;
var strArriveMonth, strDepartMonth, strMonth, strYear, intCount;

intSelected = formObj.checkinDay.selectedIndex;
intArriveDate = formObj.checkinDay[intSelected].value;
intDepartSelected = formObj.checkoutDay.selectedIndex;
intDepartDate = formObj.checkoutDay[intDepartSelected].value;

if (intArriveDate != "")
{
if (intDepartDate <= intArriveDate)
{
intDepartDate = intArriveDate;
intDepartDate++;
}

intSelected = formObj.checkinMonthYear.selectedIndex;
strArriveMonth = formObj.checkinMonthYear[intSelected].value;


if (strArriveMonth.length == 8)
{
strMonth = strArriveMonth.substring(0, 3);
intArriveYear = strArriveMonth.substring(4, 8);

for (intCount = 0; intCount < 12; intCount++)
{
if (strMonth == strMonthArray[intCount])
{
intArriveMonth = intCount;
}
}
}
else
{
intArriveYear = strArriveMonth.substring(2, 6);
intArriveMonth = Number(strArriveMonth.substring(0, 2)) - 1;
}

intDepartMonth = intArriveMonth;
intDepartYear = intArriveYear;


if (intDepartDate > intDaysArray[intArriveMonth])
{
intDepartDate = 1;
intDepartMonth++;

if (intDepartMonth > 11)
{
intDepartMonth = 0;
intDepartYear++;
}
}



if (formObj.name == 'frmFeedback' || formObj.name == 'meetingRequestForm')
{
formObj.checkoutDay[intDepartDate].selected = true;
}
else
{
formObj.checkoutDay[intDepartDate-1].selected = true;
}

if (formObj.name == 'frmFeedback')
{
strMonthDisplay = strCSMonthArray[intDepartMonth] + intDepartYear;
}
else
{
strMonthDisplay = strMonthArray[intDepartMonth] + " " + intDepartYear;
}

for (intCount = 0; intCount < formObj.checkoutMonthYear.options.length; intCount++)
{
if (strMonthDisplay == formObj.checkoutMonthYear[intCount].value)
{
formObj.checkoutMonthYear[intCount].selected = true;
}
}
}

return;
}

function showCalendar(formObj, strType, strDirection)
{
var strMonth, intMonth, intYear, calWindow;
var loopCount, strURL;

if (strType == "event")
{
strMonth = formObj.eventMonthYear[formObj.eventMonthYear.selectedIndex].value;
}
else if (strType == "altEvent")
{
strMonth = formObj.altEventMonthYear[formObj.altEventMonthYear.selectedIndex].value;
}
else if (strType == "arrive")
{
strMonth = formObj.checkinMonthYear[formObj.checkinMonthYear.selectedIndex].value;
}
else if (formObj.checkoutMonthYear)
{
strMonth = formObj.checkoutMonthYear[formObj.checkoutMonthYear.selectedIndex].value;
}

if (strMonth != "")
{
if (strMonth.length == 8)
{
intYear = strMonth.substring(4, 8);
strMonth = strMonth.substring(0, 3);
for (i = 0; i < 12; i++)
{
if (strMonth == strMonthArray[i])
{
intMonth = i + 1;
}
}
}
else
{
intYear = strMonth.substring(2, 6);
intMonth = Number(strMonth.substring(0, 2));
}
strURL = "/reservation/calendar.jsp?direction=" + strDirection + "&field=" + strType + "&month=" + intMonth + "&year=" + intYear + "&formName=document." + formObj.name;
}
else
{
strURL = "/reservation/calendar.jsp?direction=" + strDirection + "&field=" + strType + "&formName=document." + formObj.name;
}

OpenPopupWindow(strURL, "Calendar", "no", "N");

return;
}

function getCalendarValues (fieldName, intDay, intMonth, intYear, formObj)
{
var arriveDate, arriveMonth, arriveYear;
var departDate, departMonth, departYear;

if (fieldName == "arrive")
{
arriveDate = intDay;
arriveMonth = intMonth - 1;
arriveYear = intYear;

if (formObj.checkoutDay && formObj.checkoutMonthYear)
{
departDate = Number(formObj.checkoutDay[formObj.checkoutDay.selectedIndex].value);
departMonth = formObj.checkoutMonthYear[formObj.checkoutMonthYear.selectedIndex].value;
if (departMonth.length == 8)
{
departYear = departMonth.substring(0, 3);
departMonth = departMonth.substring(4, 8);
}
else
{
departYear = departMonth.substring(2, 6);
departMonth = Number(departMonth.substring(0, 2)) - 1;
}
}
}
else
{
departDate = intDay;
departMonth = intMonth - 1;
departYear = intYear;

arriveDate = Number(formObj.checkinDay[formObj.checkinDay.selectedIndex].value);
arriveMonth = formObj.checkinMonthYear[formObj.checkinMonthYear.selectedIndex].value;

if (arriveMonth.length == 8)
{
arriveYear = arriveMonth.substring(0, 3);
arriveMonth = arriveMonth.substring(4, 8);
}
else
{
arriveYear = arriveMonth.substring(2, 6);
arriveMonth = Number(arriveMonth.substring(0, 2)) - 1;
}
}

selectDates(formObj, arriveDate, departDate, arriveMonth, departMonth, arriveYear, departYear);

if (fieldName == "arrive" && formObj.checkoutDay && formObj.checkoutMonthYear)
{
changeDepartDate(formObj);
}

return;
}

function selectDates (formObj, intArriveDate, intDepartDate, intArriveMonth, intDepartMonth, intArriveYear, intDepartYear)
{
var intCount, strMonthDisplay;



if (formObj.name == 'frmFeedback' || formObj.name == 'meetingRequestForm')
{
formObj.checkinDay.options[intArriveDate].selected = true;
if (formObj.checkoutDay)
{
formObj.checkoutDay.options[intDepartDate].selected = true;
}
}
else
{
formObj.checkinDay.options[intArriveDate-1].selected = true;
if (formObj.checkoutDay)
{
formObj.checkoutDay.options[intDepartDate-1].selected = true;
}
}



if (formObj.name == 'frmFeedback')
{
strMonthDisplay = strCSMonthArray[intArriveMonth] + intArriveYear;
}
else
{
strMonthDisplay = strMonthArray[intArriveMonth] + " " + intArriveYear;
}

for (intCount = 0; intCount < formObj.checkinMonthYear.options.length; intCount++)
{
if (strMonthDisplay == formObj.checkinMonthYear[intCount].value)
{
formObj.checkinMonthYear[intCount].selected = true;
}
}

if (formObj.name == 'frmFeedback')
{
strMonthDisplay = strCSMonthArray[intDepartMonth] + intDepartYear;
}
else
{
strMonthDisplay = strMonthArray[intDepartMonth] + " " + intDepartYear;
}

if (formObj.checkoutMonthYear)
{
for (intCount = 0; intCount < formObj.checkoutMonthYear.options.length; intCount++)
{
if (strMonthDisplay == formObj.checkoutMonthYear[intCount].value)
{
formObj.checkoutMonthYear[intCount].selected = true;
}
}
}

return;
}

function selectCity(formObj, pPrompt)
{
if (formObj.city.value == pPrompt)
{
formObj.city.select();
}
}

function setAnonymous(pForm)
{
if (pForm.anonymousRequest.checked == true)
{
pForm.firstName.value = ""; pForm.firstName.disabled = true;
pForm.lastName.value = ""; pForm.lastName.disabled = true;
pForm.addressLine1.value = ""; pForm.addressLine1.disabled = true;
pForm.addressLine2.value = ""; pForm.addressLine2.disabled = true;
pForm.addressLine3.value = ""; pForm.addressLine3.disabled = true;
pForm.city.value = ""; pForm.city.disabled = true;
pForm.state.value = ""; pForm.state.disabled = true;
pForm.zipCode.value = ""; pForm.zipCode.disabled = true;
pForm.country.value = ""; pForm.country.disabled = true;
pForm.phoneCountryCode.value = ""; pForm.phoneCountryCode.disabled = true;
pForm.phoneAreaCode.value = ""; pForm.phoneAreaCode.disabled = true;
pForm.phoneNumber.value = ""; pForm.phoneNumber.disabled = true;
pForm.phoneExtension.value = ""; pForm.phoneExtension.disabled = true;
pForm.emailAddress.value = ""; pForm.emailAddress.disabled = true;
pForm.contactRequested[0].disabled = true;
pForm.contactRequested[1].disabled = true;
pForm.contactRequested[1].checked = true;
pForm.goldRewardsNumber.value = ""; pForm.goldRewardsNumber.disabled = true;
}
else
{
pForm.firstName.disabled = false;
pForm.lastName.disabled = false;
pForm.addressLine1.disabled = false;
pForm.addressLine2.disabled = false;
pForm.addressLine3.disabled = false;
pForm.city.disabled = false;
pForm.state.disabled = false;
pForm.zipCode.disabled = false;
pForm.country.disabled = false;
pForm.phoneCountryCode.disabled = false;
pForm.phoneAreaCode.disabled = false;
pForm.phoneNumber.disabled = false;
pForm.phoneExtension.disabled = false;
pForm.emailAddress.disabled = false;
pForm.contactRequested[0].disabled = false;
pForm.contactRequested[1].disabled = false;
pForm.goldRewardsNumber.disabled = false;
}
}

function showForecast(pShow)
{
if (pShow)
{
Effect.SlideDown('forecast2');
Effect.SlideDown('forecast3');
Effect.Fade('showForecastLink');
Effect.Appear('hideForecastLink');
}
else
{
Effect.SlideUp('forecast2');
Effect.SlideUp('forecast3');
Effect.Fade('hideForecastLink');
Effect.Appear('showForecastLink');
}
}

function addHotel()
{
document.myAccountForm[1].action.value = "add";
document.myAccountForm[1].submit();
}

function showStaticDetailDiv(pElementId)
{
toggleSelects(true);
new Effect.BlindDown(pElementId);
}

function hideStaticDetailDiv(pElementId)
{
toggleSelects(false);
new Effect.BlindUp(pElementId);
}

function toggleSelects(pMakeHidden)
{
var lSelectElements = document.body.getElementsByTagName("SELECT");
var lVisible = pMakeHidden ? "hidden" : "visible";

for(i = 0; i < lSelectElements.length; i++)
{
var lSelect = lSelectElements[i];
lSelect.style.visibility = lVisible;
}
}

function showDetailDiv(pElementId, pDataElementId, pUri, pParams)
{
toggleSelects(true);
new Effect.BlindDown(pElementId);
var myAjax = new Ajax.Updater(
pDataElementId,
pUri,
{
method: 'get',
parameters: pParams
})
}

function hideDetailDiv(pElementId, pDataElementId, pText)
{
toggleSelects(false);
new Effect.BlindUp(pElementId);
setTimeout('$(\'' + pDataElementId + '\').innerHTML = \'' + pText + '\'', 2000);
}

function submitSpecialRates()
{
$('specialRatesForm').submit();
}

function getCityId(text, li) 
{
clearCityId = false;
var lCityId = $('cityId');
lCityId.value = li.id;

lCountry = li.innerHTML.substr(li.innerHTML.indexOf('(') + 1, 2);
if ($('country'))
{
$('country').value = lCountry;
updateStateOptions($('countryAndState'), lCountry); 
}

lState = '';
if (li.innerHTML.indexOf(',') > 0)
{
lState = li.innerHTML.substr(li.innerHTML.indexOf(',') + 2, 2);

if ($('countryAndState') && $('country'))
{
$('countryAndState').value = $F('country') + " " + lState;
}
}
lCityStateCountry = $('autocomplete').value + lState + lCountry;
}

function defaultHomePageDates()
{
var lDate = new Date();
var lMonth = (lDate.getMonth() + 1);
var lDay = lDate.getDate();
var lYear = lDate.getFullYear();

lMonth = (lMonth > 9) ? lMonth : "0" + lMonth;
lDay = (lDay > 9) ? lDay : "0" + lDay;

var lToday = lMonth + "/" + lDay + "/" + lYear;

lDate.setDate(lDate.getDate() + 1);
lMonth = (lDate.getMonth() + 1);
lDay = lDate.getDate();
lMonth = (lMonth > 9) ? lMonth : "0" + lMonth;
lDay = (lDay > 9) ? lDay : "0" + lDay;

var lTomorrow = lMonth + "/" + lDay + "/" + lYear;

document.getElementById('checkinDate').value = lToday;
document.getElementById('checkoutDate').value = lTomorrow;
}

function defaultBlankDates()
{
var lCheckin = $('checkinDate');
var lCheckout = $('checkoutDate');
var DATE_FORMAT = "mm/dd/yyyy";

if (lCheckin.value == "")
{
lCheckin.value = DATE_FORMAT;
}

if (lCheckout.value == "")
{
lCheckout.value = DATE_FORMAT;
}
}

function getRadEdwAttractions(pSelect)
{
var lUrl = pSelect[pSelect.selectedIndex].value;
if (lUrl.length == 0)
{
new Effect.BlindUp('attractionResultsHeader');
return;
}

var myAjax = 
new Ajax.Updater(
'attractionResults',
lUrl,
{
method: 'get',
evalScripts: true, 
onComplete: function(){ new Effect.BlindDown('attractionResultsHeader'); 
setTimeout("new Effect.Highlight('attractionResultsHeader');", 1000);}
})
}

function getAttractions(text, li) 
{
var lCityId = $('cityId');
lCityId.value = li.id;
updateAttractions();
}

function adjustAttractionUrl()
{
if (!lSuggests)
{
return;
}

var lUrl = "/lcrSearch?suggest=true&maxResults=10";
A1.url = lUrl; 
}

function adjustUrl()
{
if (!lSuggests)
{
return;
}

var lUrl = "/lcrSearch?suggest=true&maxResults=5";
lCountry = '';
if ($('country') && $F('country').length > 1)
{
lCountry = $F('country');
lUrl += '&country=' + lCountry;
}
lState = '';
if ($('countryAndState') && $F('countryAndState').length > 4)
{
lState = $F('countryAndState').substr($F('countryAndState').indexOf(' ') + 1, 2);
lUrl += '&state=' + lState;
}
A1.url = lUrl; 



if ($('cityId') && $F('cityId') != '')
{
if (lCityStateCountry != $F('autocomplete') + lState + lCountry)
{
$('cityId').value = '';
lCityStateCountry = '';
}
}
}

function showAttraction(pRadEdw)
{
Effect.Fade('location');
setTimeout("new Effect.Appear('attraction');", 900);
setTimeout("new Effect.Highlight('locationAttraction');", 1400);
if (!pRadEdw)
{
setTimeout("$('autocompleteAttraction').focus();", 1000);

if ($('cityId').value != '')
{
$('autocompleteAttraction').value = $('autocomplete').value;

setTimeout("updateAttractions();", 1000);
}
}
}

function updateAttractions()
{
if (!$('cityId') || $F('cityId') === '' || $F('cityId') === '0')
{
return;
}
var myAjax = 
new Ajax.Updater(
'attractionResults',
'/lcrSearch',
{
method: 'get',
parameters: 'cityId=' + $('cityId').value,
onComplete: function(){ new Effect.BlindDown('attractionResultsHeader'); 
setTimeout("new Effect.Highlight('attractionResultsHeader');", 1200);}
})
}

function showLocation(pRadEdw)
{
Effect.Fade('attraction');
setTimeout("new Effect.Appear('location');", 900);
setTimeout("new Effect.Highlight('locationAttraction');", 1400);
if (!pRadEdw)
{
setTimeout("$('autocomplete').focus();", 1000);
}
}
