/*
 * Copyright (c) 2007 John Resig (jquery.com)
 * Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Copyright (c) 2007 cody lindley
 * Copyright (c) 2007 Jörn Zaefferer
 * Copyright 2007 Yehuda Katz, Rein Henrichs
 * Copyright (c) 2007 Christian Bach
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * 
 * Copyright (c) 2008, Yahoo! Inc. All rights reserved.
 * Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt
 *
 * Copyright: 2006 Mark Wubben.
 * This software is licensed and provided under the CC-GNU LGPL.
 * See <http://creativecommons.org/licenses/LGPL/2.1/>
 *
 * Copyright 2005 Joe Walker
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Copyright (c)2005-2007 Matt Kruse (javascripttoolbox.com)
 * Dual licensed under the MIT and GPL licenses.
 *
 * Copyright (C) 2008 OnSurvey Inc.
 */

if (typeof Hampton === 'undefined') {
	Hampton = {};
}
if (typeof Hampton.Config === 'undefined') {
	Hampton.Config = {};
}
Hampton.Config.Booking = {
	
	// Where the AJAX call is made to
	autoCompleteBaseUrl: 'development/newyork.json'
	// G_CONTEXT_PATH + "/sayt/"
};



// map tagId to "real name"
if (netui_tagIdNameMap == null)
   var netui_tagIdNameMap = new Object();
netui_tagIdNameMap.dummyFormIntask="dummyFormIntask"
// lookup by tagId to "real name"
function lookupNameByTagId(id, tag)
{
   var idScope = lookupIdScope(tag,"_");
   if (idScope == "")
      return netui_tagIdNameMap[id];
   else
      return netui_tagIdNameMap[idScope  + "__" + id];
}

/*############ Begin common/js/base.js ############*/
jQuery.noConflict();
jQuery(document).ready(function($) {
    jQuery(".jsShow").removeClass("hide");
    jQuery(".jsHide").hide();
    buttonizeAllSubmits();
    jQuery("a.thickbox").each(function() {
        var rel = jQuery(this).attr("rel");
        jQuery(this).attr("href", rel);
    });
    jQuery(".toggler").click(function() {
        var link = jQuery(this);
        href = link.attr("href");
        if (link.hasClass("collapsed")) {
            jQuery(href).show();
            link.addClass("expanded").removeClass("collapsed");
        } else {
            jQuery(href).hide();
            link.removeClass("expanded").addClass("collapsed");
        }
        return false;
    });
    jQuery("div.jsTabCollection").find("div.tabSection:gt(0)").hide();
    jQuery("div.jsTabCollection").find("ul.jsTabify li:eq(0)").addClass("on");
    jQuery("ul.jsTabify").addClass("ulTabs");
    jQuery("ul.jsTabify li a").click(function() {
        var onlink = jQuery(this);
        onlink.parents(".jsTabCollection").find("ul.jsTabify li").removeClass("on");
        onlink.parent("li").addClass("on");
        var href = onlink.attr("href");
        jQuery(href).siblings("div.tabSection").hide();
        jQuery(href).show();
        return false;
    });
});
function buttonizeAllSubmits() {
    jQuery("input.btnSearch").each(function() {
        var input = jQuery(this);
        var txt = input.val();
        var click = input.attr("onclick");
        if (jQuery.browser.msie) {
            var click = click.toString();
            clicklength = click.length;
            click = click.substring(23, clicklength - 2);
        }
        input.after('<a class="btnSearch" href="#" onclick="' + click + '">' + txt + "</a>");
        input.addClass("hide2");
    });
    jQuery("input.btn").each(function() {
        var input = jQuery(this);
        var txt = input.val();
        var click = input.attr("onclick");
        if (jQuery.browser.msie) {
            var click = click.toString();
            clicklength = click.length;
            click = click.substring(23, clicklength - 2);
        }
        input.after('<a class="btn" href="javascript:void(0)" onclick="' + click + '"><span>' + txt + "</span></a>");
        input.addClass("hide2");
    });
}
function openPopup(link, width, height, popupname) {
    width = width || 300;
    height = height || 400;
    popupname = popupname || "popup";
    if (typeof link != "string") {
        link = jQuery(link).attr("href");
    }
    try {
        window.open(link, popupname, "resizable=1,location=0,toolbar=0,scrollbars=1,width=" + width + ",height=" + height);
    } catch(err) {
        alert(err);
    }
    return false;
}
function clearThisField(textbox, defaultText) {
    if (textbox.value == defaultText) {
        textbox.value = "";
    }
}
function restoreFieldText(textbox, defaultText) {
    if (textbox.value == "") {
        textbox.value = defaultText;
    }
}
function toggle(link) {
    var link = jQuery(link);
    href = link.attr("href");
    if (link.hasClass("collapsed")) {
        jQuery(href).show();
        link.addClass("expanded").removeClass("collapsed");
    } else {
        jQuery(href).hide();
        link.removeClass("expanded").addClass("collapsed");
    }
}
/*############ End common/js/base.js ############*/
/*############ Begin common/js/plug/brandSite.js ############*/
jQuery(document).ready(function() {
    jQuery("span.whatsThisHint").hide();
    jQuery(".offerPkg:last").css({
        border: "none",
        "padding-bottom": "16px"
    });
    jQuery("#comparingHotels").hide();
    jQuery("#rfp_equipment_screen_toggle").hide();
    var roomSelectedYes = jQuery("#rfp_accomm_reqs1[@type=radio]:checked").size();
    var functionSelectedYes = jQuery("#rfp_function_room1[@type=radio]:checked").size();
    if (roomSelectedYes == 0) {
        jQuery("#rfp_checkin_toggle").hide();
    } else {
        jQuery("#rfp_checkin_toggle").show();
    }
    if (functionSelectedYes == 0) {
        jQuery("#rfp_function_toggle").hide();
    } else {
        jQuery("#rfp_function_toggle").show();
    }
    jQuery("#participatingHotelsH2").toggle(function() {
        jQuery(this).addClass("collapsedh2");
        jQuery("#participatingHotels").hide();
    },
    function() {
        jQuery(this).removeClass("collapsedh2");
        jQuery("#participatingHotels").show();
    });
    jQuery("#comparingHotelsH2").toggle(function() {
        jQuery(this).addClass("expandedh2");
        jQuery("#comparingHotels").show();
    },
    function() {
        jQuery(this).removeClass("expandedh2");
        jQuery("#comparingHotels").hide();
    });
    jQuery("div.jsTabCollection").find("div.tabSection:gt(0)").hide();
    jQuery("div.jsTabCollection").find("ul.jsTabify li:eq(0)").addClass("on");
    jQuery("ul.jsTabify").addClass("ulTabs");
    jQuery("ul.jsTabify li a").click(function() {
        var onlink = jQuery(this);
        onlink.parents(".jsTabCollection").find("ul.jsTabify li").removeClass("on");
        onlink.parent("li").addClass("on");
        var href = onlink.attr("href");
        jQuery(href).siblings("div.tabSection").hide();
        jQuery(href).show();
        return false;
    });
    if (jQuery("#offersSearchForm").length > 0) {
        var setDeafultTabs = false;
        if (document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("offersSearchType", this)] != null) {
            var searchType = document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("offersSearchType", this)].value;
            if (searchType == "SearchLocation" || searchType == "SearchRemoveLocation") {
                jQuery("div.jsTabCollectionBrand").find("div.tabSection:eq(0)").hide();
                jQuery("div.jsTabCollectionBrand").find("ul.jsTabifyBrand li:eq(1)").addClass("on");
                jQuery("ul.jsTabifyBrand").addClass("ulTabs");
            } else {
                setDeafultTabs = true;
            }
        } else {
            setDeafultTabs = true;
        }
        if (setDeafultTabs) {
            jQuery("div.jsTabCollectionBrand").find("div.tabSection:gt(0)").hide();
            jQuery("div.jsTabCollectionBrand").find("ul.jsTabifyBrand li:eq(0)").addClass("on");
            jQuery("ul.jsTabifyBrand").addClass("ulTabs");
        }
    }
    jQuery("ul.jsTabifyBrand li a").click(function() {
        var onlink = jQuery(this);
        onlink.parents(".jsTabCollectionBrand").find("ul.jsTabifyBrand li").removeClass("on");
        onlink.parent("li").addClass("on");
        var href = onlink.attr("href");
        jQuery(href).siblings("div.tabSection").hide();
        jQuery(href).show();
        return false;
    });
    var locSearch = jQuery("#locsearch");
    locSearch.each(function() {
        if (this.value == "") {
            this.value = this.title;
        }
    });
    locSearch.focus(function() {
        if (this.value == this.title) {
            this.value = "";
        }
    });
    locSearch.blur(function() {
        if (this.value == "") {
            this.value = this.title;
        }
    });
    jQuery(document).keydown(function(e) {
        if (e.which == 27) {
            locSearch.blur();
        }
    });
    jQuery(".hintContainer").hover(function() {
        jQuery(this).children("span.whatsThisHint").show();
    },
    function() {
        jQuery(this).children("span.whatsThisHint").hide();
    });
    jQuery("#rfp_accomm_reqs1").click(function() {
        jQuery("#rfp_checkin_toggle").show();
    });
    jQuery("#rfp_accomm_reqs2").click(function() {
        jQuery("#rfp_checkin_toggle").hide();
    });
    jQuery("#rfp_function_room1").click(function() {
        jQuery("#rfp_function_toggle").show();
    });
    jQuery("#rfp_function_room2").click(function() {
        jQuery("#rfp_function_toggle").hide();
    });
    jQuery(".brandfilter .selectAll").click(function() {
        jQuery('.brandfilter input[type="checkbox"]').attr("checked", "checked");
    });
    jQuery(".brandfilter .deselectAll").click(function() {
        jQuery('.brandfilter input[type="checkbox"]').attr("checked", "");
    });
    installOffersPriceSlider();
});
function reloadOffersPriceSlider() {
    var pathToPriceSlider = G_CONTEXT_PATH + "/portlets/brand/offers/searchWidget/inc_offersPriceSliderFilter.jsp";
    jQuery("#reloadOffersPriceSlider").load(pathToPriceSlider,
    function() {
        reInstallOffersPriceSlider();
    });
}
function reInstallOffersPriceSlider() {
    installOffersPriceSlider();
    var lowValue = jQuery("#offersPriceLabelValueLowHidden").val();
    var highValue = jQuery("#offersPriceLabelValueHighHidden").val();
    if (document[lookupIdByTagId("offersSearchForm", this)] != null) {
        if (document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("minPrice", this)] != null) {
            document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("minPrice", this)].value = lowValue;
        }
        if (document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("maxPrice", this)] != null) {
            document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("maxPrice", this)].value = highValue;
        }
    }
    var currencyFormat = jQuery("#currencyFormat").val();
    var fmtValue = CurrencyUtils.formatBySymbolSuppressZeros(lowValue, G_LOCALE, currencyFormat);
    jQuery("#offersPriceValueLow").text(fmtValue);
    fmtValue = CurrencyUtils.formatBySymbolSuppressZeros(highValue, G_LOCALE, currencyFormat);
    jQuery("#offersPriceValueHigh").text(fmtValue);
    jQuery("#updatingBlockOverlay").hide();
    jQuery("#updatingBlock").hide();
}
function installOffersPriceSlider() {
    var min = jQuery("#offersPriceLabelValueLowHidden").val();
    var max = jQuery("#offersPriceLabelValueHighHidden").val();
    var step = jQuery("#offersPriceLabelValueStepHidden").val();
    var currencyFormat = jQuery("#currencyFormat").val();
    jQuery("#offersPriceSlider").slider({
        minValue: min,
        maxValue: max,
        stepping: step,
        slide: function(e, ui) {
            var fmtValue = CurrencyUtils.formatBySymbolSuppressZeros(ui.value, G_LOCALE, currencyFormat);
            if (ui.handle.id == "priceHandleLow") {
                jQuery("#offersPriceValueLow").text(fmtValue);
            }
            if (ui.handle.id == "priceHandleHigh") {
                jQuery("#offersPriceValueHigh").text(fmtValue);
            }
        },
        change: function(e, ui) {
            jQuery("#updatingBlockOverlay").show();
            jQuery("#updatingBlock").show();
            if (document[lookupIdByTagId("offersSearchForm", this)] != null) {
                if (ui.handle.id == "priceHandleLow") {
                    if (document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("minPrice", this)] != null) {
                        document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("minPrice", this)].value = ui.value;
                    }
                }
                if (ui.handle.id == "priceHandleHigh") {
                    if (document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("maxPrice", this)] != null) {
                        document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("maxPrice", this)].value = ui.value;
                    }
                }
            }
            jQuery("#updatingBlockOverlay").hide();
            jQuery("#updatingBlock").hide();
        }
    });
}
function toggleTheMap(link, openStateTxt1, ClosedStateTxt2) {
    var link = jQuery(link);
    href = link.attr("href");
    if (link.hasClass("collapsed")) {
        link.text(openStateTxt1);
        link.replaceClass("collapsed", "expanded");
        jQuery(href).show();
        jQuery(".mapMarker").show();
        jQuery(".hsresult h2").addClass("makeRoomForMapMarker");
    } else {
        link.text(ClosedStateTxt2);
        link.replaceClass("expanded", "collapsed");
        jQuery(href).hide();
        jQuery(".mapMarker").hide();
        jQuery(".hsresult h2").removeClass("makeRoomForMapMarker");
    }
    return false;
}
function toggleCloserLook(link, openStateTxt1, ClosedStateTxt2) {
    var link = jQuery(link);
    if (link.hasClass("collapsed")) {
        link.text(openStateTxt1);
        link.replaceClass("collapsed", "expanded");
        jQuery(link).parents(".hsresult").find(".closerLook").slideToggle();
    } else {
        link.text(ClosedStateTxt2);
        link.replaceClass("expanded", "collapsed");
        jQuery(link).parents(".hsresult").find(".closerLook").slideToggle();
    }
    return false;
}
function toggleOptionalFields(link, txt1, txt2) {
    var $jlink = jQuery(link);
    href = $jlink.attr("href");
    if ($jlink.hasClass("collapsed")) {
        jQuery(href).show();
        $jlink.addClass("expanded").removeClass("collapsed");
        $jlink.text(txt2);
    } else {
        jQuery(href).hide();
        $jlink.removeClass("expanded").addClass("collapsed");
        $jlink.text(txt1);
    }
}
function addClassToThisElement(el, classvalue) {
    jQuery(el).find(".helpHint").css("display", "block");
}
function removeClassFromThisElement(el, classvalue) {
    jQuery(el).find(".helpHint").css("display", "none");
}
function setDefalultTime(fieldName, time, timeUnit) {
    var field = jQuery("#" + fieldName);
    if (field.val() == "-1") {
        field.val(time + " " + timeUnit);
    }
    return true;
}
function resetDates() {
    if (document[lookupIdByTagId("offersSearchForm", this)] != null) {
        if (document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("checkinb", this)] != null && document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("checkinb", this)].value != null && document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("checkinb", this)].value != "") {
            document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("checkinb", this)].value = "";
        }
        if (document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("checkoutb", this)] != null && document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("checkoutb", this)].value != null && document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("checkoutb", this)].value != "") {
            document[lookupIdByTagId("offersSearchForm", this)][lookupIdByTagId("checkoutb", this)].value = "";
        }
    }
}
function checkBrandHomePageFlash() {
    if (flashInstalled == "true") {
        if (document.getElementById("flashObject")) {
            if (document.getElementById("flashAltImage")) {
                document.getElementById("flashObject").style.display = "block";
                document.getElementById("flashAltImage").style.display = "none";
            }
        }
    } else {
        if (document.getElementById("messageBlock")) {
            document.getElementById("messageBlock").innerHTML = "Please enable Flash for smooth browsing";
        }
    }
}
/*############ End common/js/plug/brandSite.js ############*/
/*############ Begin common/js/plug/enrollment.js ############*/
jQuery(document).ready(function() {
    var joinHiltonHHonorsOptions = jQuery("#joinHiltonHHonorsOptions");
    var createReservationProfileOptions = jQuery("#createReservationProfileOptions");
    if (!document.getElementById("createReservationProfileRadio")) {
        return;
    }
    if (document.getElementById("createReservationProfileRadio").checked == false) {
        createReservationProfileOptions.hide();
        createReservationProfileOptions.removeClass("enrollCurrent");
    } else {
        createReservationProfileOptions.addClass("enrollCurrent");
    }
    if (document.getElementById("hiltonHhonorsRadio").checked == false) {
        joinHiltonHHonorsOptions.hide();
        joinHiltonHHonorsOptions.removeClass("enrollCurrent");
    } else {
        joinHiltonHHonorsOptions.addClass("enrollCurrent");
    }
    jQuery("#hiltonHhonorsRadio").click(function() {
        joinHiltonHHonorsOptions.slideDown();
        joinHiltonHHonorsOptions.addClass("enrollCurrent");
        if (createReservationProfileOptions.hasClass("enrollCurrent")) {
            createReservationProfileOptions.slideUp();
            createReservationProfileOptions.removeClass("enrollCurrent");
        }
    });
    jQuery("#createReservationProfileRadio").click(function() {
        createReservationProfileOptions.slideDown();
        createReservationProfileOptions.addClass("enrollCurrent");
        if (joinHiltonHHonorsOptions.hasClass("enrollCurrent")) {
            joinHiltonHHonorsOptions.slideUp();
            joinHiltonHHonorsOptions.removeClass("enrollCurrent");
        }
    });
});
function displayError() {
    var errorDiv = document.createElement("div");
    errorDiv.className = "errorListing";
    ulError = document.createElement("ul");
    ulError.appendChild(document.createTextNode("The desired username already exists, please choose a different username"));
    errorDiv.appendChild(ulError);
    document.body.appendChild(errorDiv);
}
/*############ End common/js/plug/enrollment.js ############*/
/*############ Begin common/js/plug/account.js ############*/
var MAX_NUM_EMAIL_ADDRESSES = 3;
var MAX_NUM_PHONE_NUMBERS = 3;
var MAX_NUM_CREDIT_CARDS = 3;
var MAX_NUM_TRAVEL_PARTNERS = 5;
jQuery(document).ready(function() {
    jQuery("#delayMessage").hide();
    jQuery("#selectYourSex").hide();
    var myTitle = jQuery("#selectTitle").val();
    handleTheSexSelect(myTitle, "0");
    jQuery("#selectTitle").change(function() {
        handleTheSexSelect(this.options[this.selectedIndex].value, "1");
    });
    jQuery("#newPasswordInputs").hide();
    jQuery("#newUsername").hide();
    jQuery("#newHhonorsPin").hide();
    jQuery("#createUsernamePassword").hide();
    jQuery("input.preferred:checked").siblings(".deleteEmail").hide();
    jQuery(".showForSwitchMaestro").hide();
    hideShowRows("email", "Email", MAX_NUM_EMAIL_ADDRESSES);
    hideShowRows("phone", "Phone", MAX_NUM_PHONE_NUMBERS);
    hideShowRows("payment", "Payment", MAX_NUM_CREDIT_CARDS);
    jQuery("a.helptip:has(span.tip)").hover(function() {
        jQuery(this).addClass("reveal");
    },
    function() {
        jQuery(this).removeClass("reveal");
    });
    jQuery("div.details").hide();
    jQuery("div.selectedDetails").show();
    jQuery("whatsThisHint").hide();
    jQuery(".hintContainer").hover(function() {
        jQuery(this).children("span.questionMarkHint").show();
    },
    function() {
        jQuery(this).children("span.questionMarkHint").hide();
    });
    jQuery("#travelPartner1").hide();
    jQuery("#travelPartner2").hide();
    jQuery("#travelPartner3").hide();
    jQuery("#travelPartner4").hide();
    jQuery("#addTravelPartner2").hide();
    jQuery("#addTravelPartner3").hide();
    jQuery("#addTravelPartner4").hide();
    jQuery("#addTravelPartner5").hide();
    jQuery(".modalbody").hide();
    jQuery("h3.emailInterestsHeader").click(function() {
        emailInterests();
        return false;
    });
    jQuery("#enrollLanguagePreferred").change(function() {
        handleTheLanguagePreference(this.options[this.selectedIndex].value);
    });
    jQuery("#enrollLanguagePreferred").removeClass("hide");
    if (jQuery("#enrollLanguagePreferred").hasClass("emailFormLanguageSelect")) {
        handleTheLanguagePreference(jQuery("#enrollLanguagePreferred").value);
    }
    if (jQuery("h3.emailInterestsHeader").hasClass("clear")) {
        if (document.getElementById("unsubscribeFromMarketing").checked) {
            disablePromos();
        }
    }
});
function expandAllVIP() {
    jQuery("#hiltonOptions").show().removeClass("collapsed").addClass("expanded");
    jQuery(".hilton h2 a").removeClass("collapsed").addClass("expanded");
    jQuery("#embassy_suitesOptions").show().removeClass("collapsed").addClass("expanded");
    jQuery(".embassy_suites h2 a").removeClass("collapsed").addClass("expanded");
    jQuery("#doubletreeOptions").show().removeClass("collapsed").addClass("expanded");
    jQuery(".doubletree h2 a").removeClass("collapsed").addClass("expanded");
    jQuery("#hamptonOptions").show().removeClass("collapsed").addClass("expanded");
    jQuery(".hampton h2 a").removeClass("collapsed").addClass("expanded");
    jQuery("#garden_innOptions").show().removeClass("collapsed").addClass("expanded");
    jQuery(".garden_inn h2 a").removeClass("collapsed").addClass("expanded");
    jQuery("#homewoodOptions").show().removeClass("collapsed").addClass("expanded");
    jQuery(".homewood h2 a").removeClass("collapsed").addClass("expanded");
    jQuery("#waldorfOptions").show().removeClass("collapsed").addClass("expanded");
    jQuery(".waldorf h2 a").removeClass("collapsed").addClass("expanded");
}
function collapseAllVIP() {
    jQuery("#hiltonOptions").hide().removeClass("expanded").addClass("collapsed");
    jQuery(".hilton h2 a").removeClass("expanded").addClass("collapsed");
    jQuery("#embassy_suitesOptions").hide().removeClass("expanded").addClass("collapsed");
    jQuery(".embassy_suites h2 a").removeClass("expanded").addClass("collapsed");
    jQuery("#doubletreeOptions").hide().removeClass("expanded").addClass("collapsed");
    jQuery(".doubletree h2 a").removeClass("expanded").addClass("collapsed");
    jQuery("#hamptonOptions").hide().removeClass("expanded").addClass("collapsed");
    jQuery(".hampton h2 a").removeClass("expanded").addClass("collapsed");
    jQuery("#garden_innOptions").hide().removeClass("expanded").addClass("collapsed");
    jQuery(".garden_inn h2 a").removeClass("expanded").addClass("collapsed");
    jQuery("#homewoodOptions").hide().removeClass("expanded").addClass("collapsed");
    jQuery(".homewood h2 a").removeClass("expanded").addClass("collapsed");
    jQuery("#waldorfOptions").hide().removeClass("expanded").addClass("collapsed");
    jQuery(".waldorf h2 a").removeClass("expanded").addClass("collapsed");
}
function emailInterests() {
    if (jQuery("#emailInterestsToggler").hasClass("viewEmailInterests")) {
        jQuery("div.emailInterests").slideDown();
        jQuery("#emailInterestsToggler").toggleClass("closeEmailInterests").toggleClass("viewEmailInterests");
    } else {
        jQuery("div.emailInterests").slideUp();
        jQuery("#emailInterestsToggler").toggleClass("closeEmailInterests").toggleClass("viewEmailInterests");
    }
}
function handleTheLanguagePreference(ind) {
    var languagePreference = jQuery("#enrollLanguagePreferred");
    switch (ind) {
    case "CH":
        hideTheOtherLanguages();
        jQuery("ul.newsletterSelectCH").removeClass("hide");
        break;
    case "EN":
        hideTheOtherLanguages();
        jQuery("ul.newsletterSelectEN").removeClass("hide");
        break;
    case "FE":
        hideTheOtherLanguages();
        jQuery("ul.newsletterSelectFE").removeClass("hide");
        break;
    case "GR":
        hideTheOtherLanguages();
        jQuery("ul.newsletterSelectGR").removeClass("hide");
        break;
    case "JA":
        hideTheOtherLanguages();
        jQuery("ul.newsletterSelectJA").removeClass("hide");
        break;
    case "SP":
        hideTheOtherLanguages();
        jQuery("ul.newsletterSelectSP").removeClass("hide");
        break;
    default:
        hideTheOtherLanguages();
        jQuery("ul.newsletterSelectNone").removeClass("hide");
        break;
    }
}
function hideTheOtherLanguages() {
    jQuery("ul.newsletterLanguageSelect").addClass("hide");
}
function disablePromos() {
    jQuery("#unsubscribeFromMarketing").toggleClass("promosDisabled");
    if (jQuery("#unsubscribeFromMarketing").hasClass("promosDisabled")) {
        jQuery("div.emailNewsletters ul li input.checkbox").attr("disabled", "disabled");
        jQuery("div.emailInterests ul li input.checkbox").attr("disabled", "disabled");
    } else {
        jQuery("div.emailNewsletters ul li input.checkbox").removeAttr("disabled");
        jQuery("div.emailInterests ul li input.checkbox").removeAttr("disabled");
    }
}
function showRows(number) {
    var rows = document.getElementsByTagName("tbody");
    rows = rows[0];
    rows = rows.getElementsByTagName("tr");
    if (number == "all") {
        number = rows.length;
    }
    for (var i = 0; i < rows.length; i++) {
        rows[i].style.display = "none";
    }
    for (var i = 0; i < number; i++) {
        rows[i].style.display = "";
    }
}
function showRows2(number) {
    switch (number) {
    case "0":
        showRows(0);
        break;
    case "1":
        showRows(3);
        break;
    case "2":
        showRows(5);
        break;
    case "3":
        showRows("all");
        break;
    }
}
function addFormFieldEmail() {
    var counterEmailId = document.getElementById("counterEmail").value;
    jQuery("#newEmail").append('<p id="emailRow' + counterEmailId + '" class="newEmailRow' + counterEmailId + '"><label for="newEmail' + counterEmailId + '" class="hide">Email </label><input type="text" size="20" name="newEmail" id="newEmail' + counterEmailId + '" class="text email created"> <input type="radio" id="email' + counterEmailId + 'NewPreferred" name="emailPreferred" class="radio preferred" onclick="hideDeleteForPreferredEmail(this);" /><label for="email' + counterEmailId + 'NewPreferred">Preferred</label> <span class="deleteEmail"><input type="checkbox" id="email' + counterEmailId + 'NewDelete" class="deleteThis" onclick="toBeDeleted(this);" /><label for="email' + counterEmailId + 'NewDelete" class="checkbox delete">Delete</label></span></p>');
    if (!$.browser.safari) {
        jQuery(".newEmailRow" + counterEmailId).animate({
            backgroundColor: "#FFFCBF"
        },
        200).animate({
            backgroundColor: "white"
        },
        500);
    }
    jQuery("#newEmail" + counterEmailId).focus();
    counterEmailId = (counterEmailId - 1) + 2;
    document.getElementById("counterEmail").value = counterEmailId;
}
function addFormFieldPhone() {
    var counterPhoneId = document.getElementById("counterPhone").value;
    jQuery("#newPhone").append('<p id="phoneRow' + counterPhoneId + '" class="newPhoneRow' + counterPhoneId + '"><label for="newPhone' + counterPhoneId + '" class="hide">Phone Number </label><input type="text" size="20" name="newPhone" id="newPhone' + counterPhoneId + '" class="text"> <label for="phone' + counterPhoneId + 'NewSelect" class="hide">Phone Type</label><select class="select"><option selected="selected">Select</option><option>Home</option><option>Work</option><option>Mobile</option></select> <input type="radio" id="phone' + counterPhoneId + 'NewPreferred" name="phonePreferred" class="radio" /><label for="phone' + counterPhoneId + 'NewPreferred">Preferred</label> <span class="delete"><input type="checkbox" id="phone' + counterPhoneId + 'NewDelete" class="deleteThis" onclick="toBeDeleted(this);" /><label for="phone' + counterPhoneId + 'NewDelete" class="checkbox delete">Delete</label></span></p>');
    jQuery(".newPhoneRow" + counterPhoneId).animate({
        backgroundColor: "#FFFCBF"
    },
    200).animate({
        backgroundColor: "white"
    },
    500);
    jQuery("#newPhone" + counterPhoneId).focus();
    counterPhoneId = (counterPhoneId - 1) + 2;
    document.getElementById("counterPhone").value = counterPhoneId;
}
function addFormFieldPayment() {
    var counterPaymentId = document.getElementById("counterPayment").value;
    jQuery("#newPayment").append('<p id="paymentRow' + counterPaymentId + '" class="newPaymentRow' + counterPaymentId + '"><label for="newPaymentType' + counterPaymentId + '" class="hide">Type</label><select id="newPaymentType' + counterPaymentId + '" class="select"><option selected="selected">Select</option><option>American Express</option><option>Mastercard</option><option>Visa</option><option>Discover</option><option>Carte Blanche</option><option>Diner&rsquo;s Club</option><option>HHonors Amex Swedish/Finnish Cobrand Card</option><option>Honors Plat Mastercard-HFC</option><option>HHonors Platinum Card for American Express</option><option>HHonors Visa Signature Card from Citibank</option><option>HHonors Visa Sumitomo</option><option>JAL Mileage Bank Mastercard</option><option>JCB</option></select><label for="newPaymentNumber' + counterPaymentId + '">Number </label><input type="text" id="newPaymentNumber' + counterPaymentId + '" class="text" value="" class="text" /> <label for="newPaymentExpiration' + counterPaymentId + '">Expiry (MM/YY)</label> <input type="text" id="newPaymentExpiration' + counterPaymentId + '" class="text short" maxlength="5" /> <input type="radio" id="newPayment' + counterPaymentId + 'Preferred" class="radio" value="newPayment' + counterPaymentId + 'Preferred" name="paymentPreferred" class="radio" /><label for="newPayment' + counterPaymentId + 'Preferred">Preferred</label> <span class="delete"><input type="checkbox" id="newPayment' + counterPaymentId + 'Delete" class="deleteThis" onclick="toBeDeleted(this);" /><label for="newPayment' + counterPaymentId + 'Delete" class="checkbox delete">Delete</label></span></p>');
    jQuery(".newPaymentRow" + counterPaymentId).animate({
        backgroundColor: "#FFFCBF"
    },
    200).animate({
        backgroundColor: "white"
    },
    500);
    jQuery("#newPaymentType" + counterPaymentId).focus();
    counterPaymentId = (counterPaymentId - 1) + 2;
    document.getElementById("counterPayment").value = counterPaymentId;
}
function showCreateUsernamePassword() {
    jQuery("#createUsernamePassword").show();
    jQuery("span#createUsernamePasswordLink").hide();
    jQuery("#createUsernameAndPasswordArea").hide();
    jQuery("#createUsernamePassword").animate({
        backgroundColor: "#FFFCBF"
    },
    0).animate({
        backgroundColor: "white"
    },
    1000);
    jQuery("#createUsername").focus();
}
function showChangeUsername() {
    jQuery("#newUsername").show();
    jQuery("span#changeUsernameLink").hide();
    jQuery("p#currentUsername").hide();
    jQuery("#usernameHelp").hide();
    jQuery("#newUsername").animate({
        backgroundColor: "#FFFCBF"
    },
    0).animate({
        backgroundColor: "white"
    },
    1000);
    jQuery("#username").focus();
    document.getElementById("usernameArea").value = "true";
}
function showSelectCountry() {
    jQuery("select#selectCountry").show();
    var currentCountryIndex = jQuery("select#selectCountry")[0].selectedIndex;
    jQuery("span#changeCountryLink").hide();
    jQuery("p#changeCountry").append('<span id="cancelChangeCountryLink"><a href="#" onclick="cancelChangeCountry(' + currentCountryIndex + '); return false;">Cancel</a></span>');
    jQuery("#changeCountry").animate({
        backgroundColor: "#FFFCBF"
    },
    0).animate({
        backgroundColor: "white"
    },
    1000);
}
function cancelChangeCountry(previouslySelectedCountryIndex) {
    jQuery("span#cancelChangeCountryLink").remove();
    jQuery("span#changeCountryLink").show();
    jQuery("select#selectCountry")[0].options[previouslySelectedCountryIndex].selected = true;
    jQuery("select#selectCountry").hide();
}
function personalInformationUsernameChangeCancel() {
    jQuery("#newUsername").hide();
    jQuery("#createReservationUsername").val("");
    jQuery("#newPassword").val("");
    jQuery("#verifyPassword").val("");
    jQuery("#currentUsername").show();
    jQuery("#changeUsernameLink").show();
    document.getElementById("usernameArea").value = "false";
}
function personalInformationCreateUsernamePasswordCancel() {
    jQuery("#createUsernamePassword").hide();
    jQuery("span#createUsernamePasswordLink").show();
    jQuery("#createUsernameAndPasswordArea").show();
}
function personalInformationCurrentPasswordChange() {
    jQuery("#newPasswordInputs").show();
    jQuery("#currentPassword a").hide();
    jQuery("#currentPassword").hide();
    jQuery("#password").focus();
    jQuery("#newPasswordInputs").animate({
        backgroundColor: "#FFFCBF"
    },
    0).animate({
        backgroundColor: "white"
    },
    1000);
    document.getElementById("passwordArea").value = "true";
}
function personalInformationCurrentPasswordChangeCancel() {
    jQuery("#newPasswordInputs").hide();
    jQuery("#currentPassword").show();
    jQuery("#currentPassword a").show();
    document.getElementById("passwordArea").value = "false";
}
function personalInformationCurrentPinChange() {
    jQuery("#newHhonorsPin").show();
    jQuery("#currentPin").hide();
    jQuery("#newHhonorsPin").animate({
        backgroundColor: "#FFFCBF"
    },
    0).animate({
        backgroundColor: "white"
    },
    1000);
    document.getElementById("pinArea").value = "true";
}
function personalInformationCurrentPinChangeCancel() {
    jQuery("#newHhonorsPin").hide();
    jQuery("#currentPin").show();
    document.getElementById("pinArea").value = "false";
}
function hideDeleteForPreferredEmail(element) {
    var $mycheckedradio = jQuery(element);
    jQuery(".deleteEmail").show();
    $mycheckedradio.siblings(".deleteEmail").hide();
    $mycheckedradio.siblings(".deleteEmail").children().removeAttr("checked");
    $mycheckedradio.parent().removeClass("toBeDeleted").removeAttr("style", "background-color:pink");
    $mycheckedradio.siblings(".deleteEmail").children().removeAttr("onClick").attr("onClick", "toBeDeleted(this)");
}
function toBeDeleted(element) {
    var $mycheckbox = jQuery(element);
    if ($mycheckbox.attr("checked")) {
        $mycheckbox.parent().parent().addClass("toBeDeleted").attr("style", "background-color:pink;");
    } else {
        $mycheckbox.parent().parent().removeClass("toBeDeleted").removeAttr("style");
    }
}
function doubleDipAddTravelPartner(index) {
    var nextIndex = index + 1;
    jQuery("#travelPartner" + index).show();
    jQuery("#addTravelPartner" + index).hide();
    if (index < MAX_NUM_TRAVEL_PARTNERS) {
        jQuery("#addTravelPartner" + nextIndex).show();
    }
    jQuery("#parterName" + index).focus();
    jQuery("#travelPartner" + index).animate({
        backgroundColor: "#FFFCBF"
    },
    0).animate({
        backgroundColor: "white"
    },
    1000);
}
function doubleDipChangeEarningStyle() {
    jQuery("#delayMessage").show();
    alert("this should be a pop-up to third-party site for changing your earning style");
}
function handleTheSexSelect(ind, flag) {
    switch (ind) {
    case "male":
        jQuery("#selectYourSex").fadeOut();
        document.getElementById("selectSex").selectedIndex = 1;
        break;
    case "female":
        jQuery("#selectYourSex").fadeOut();
        document.getElementById("selectSex").selectedIndex = 2;
        break;
    case "MR":
        jQuery("#selectYourSex").fadeOut();
        document.getElementById("selectSex").selectedIndex = 1;
        break;
    case "MRS":
        jQuery("#selectYourSex").fadeOut();
        document.getElementById("selectSex").selectedIndex = 2;
        break;
    case "MISS":
        jQuery("#selectYourSex").fadeOut();
        document.getElementById("selectSex").selectedIndex = 2;
        break;
    case "MS":
        jQuery("#selectYourSex").fadeOut();
        document.getElementById("selectSex").selectedIndex = 2;
        break;
    case "PROF":
        if (G_LOCALE == "de_DE") {
            document.getElementById("selectSex").selectedIndex = 1;
            break;
        }
        jQuery("#selectYourSex").fadeIn();
        if (flag == "1") {
            document.getElementById("selectSex").selectedIndex = 0;
        }
        jQuery("#selectSex").animate({
            backgroundColor: "#FFFCBF"
        },
        0).animate({
            backgroundColor: "white"
        },
        1000);
        break;
    case "DR":
        if (G_LOCALE == "de_DE") {
            document.getElementById("selectSex").selectedIndex = 1;
            break;
        }
        jQuery("#selectYourSex").fadeIn();
        if (flag == "1") {
            document.getElementById("selectSex").selectedIndex = 0;
        }
        jQuery("#selectSex").animate({
            backgroundColor: "#FFFCBF"
        },
        0).animate({
            backgroundColor: "white"
        },
        1000);
        break;
    case "PROFF":
        document.getElementById("selectSex").selectedIndex = 2;
        break;
    case "DRF":
        document.getElementById("selectSex").selectedIndex = 2;
        break;
    case "unknown":
        jQuery("#selectYourSex").fadeIn();
        document.getElementById("selectSex").selectedIndex = 0;
        jQuery("#selectSex").animate({
            backgroundColor: "#FFFCBF"
        },
        0).animate({
            backgroundColor: "white"
        },
        1000);
        break;
    case "":
        jQuery("#selectYourSex").fadeOut();
        document.getElementById("selectSex").selectedIndex = 0;
        break;
    case "SELECT":
        jQuery("#selectYourSex").fadeOut();
        document.getElementById("selectSex").selectedIndex = 0;
        break;
    }
}
function decideIfItIsSwitchMaestro(element) {
    var myPaymentMethod = jQuery(element).val();
    if (myPaymentMethod == "SW") {
        jQuery(element).parent().siblings(".showForSwitchMaestro").show().animate({
            backgroundColor: "#FFFCBF"
        },
        0).animate({
            backgroundColor: "white"
        },
        1000);
    } else {
        jQuery(element).parent().siblings(".showForSwitchMaestro").hide();
    }
}
function personalInformationAddNewEmail(index) {
    var nextIndex = index + 1;
    jQuery("#emailRow" + index).show();
    jQuery("#addNewEmail" + index).hide();
    if (index < MAX_NUM_EMAIL_ADDRESSES) {
        jQuery("#addNewEmail" + nextIndex).show();
    }
    jQuery("#email" + index).focus();
    jQuery("#emailRow" + index).animate({
        backgroundColor: "#FFFCBF"
    },
    0).animate({
        backgroundColor: "white"
    },
    1000);
}
function personalInformationAddNewPhone(index) {
    var nextIndex = index + 1;
    jQuery("#phoneRow" + index).show();
    jQuery("#addNewPhone" + index).hide();
    if (index < MAX_NUM_PHONE_NUMBERS) {
        jQuery("#addNewPhone" + nextIndex).show();
    }
    jQuery("#phone" + index).focus();
    jQuery("#phoneRow" + index).animate({
        backgroundColor: "#FFFCBF"
    },
    0).animate({
        backgroundColor: "white"
    },
    1000);
}
function personalInformationMyCountry() {
    jQuery("#changeCountry").show();
    jQuery("#myCountry").hide();
    jQuery("#changeCountry select").show();
    jQuery("#selectCountry").animate({
        backgroundColor: "#FFFCBF"
    },
    0).animate({
        backgroundColor: "white"
    },
    1000);
}
function personalInformationAddNewPayment(index) {
    var nextIndex = index + 1;
    jQuery("#paymentRow" + index).show();
    jQuery("#addNewPayment" + index + " a").hide();
    if (index < MAX_NUM_CREDIT_CARDS) {
        jQuery("#addNewPayment" + nextIndex).show();
    }
    jQuery("#paymentRow" + index).animate({
        backgroundColor: "#FFFCBF"
    },
    0).animate({
        backgroundColor: "white"
    },
    1000);
}
function upcomingReservationsClickExpand(el) {
    var el = jQuery(el);
    if (el.hasClass("selectedExpand")) {
        el.siblings(".details").slideUp();
        el.siblings(".details").removeClass("selectedDetails");
        el.removeClass("selectedExpand");
    } else {
        el.addClass("selectedExpand");
        jQuery("a.selectedExpand").siblings(".details").addClass("selectedDetails");
        jQuery(".selectedDetails").slideDown();
    }
    return false;
}
function hideShowRows(element, Element, max) {
    var row = "#" + element + "Row";
    var anchor = "#addNew" + Element;
    var showIndex = "-1";
    for (var i = 0; i < max; i++) {
        var index = element + i;
        if (document.getElementById(index) != null) {
            if (document.getElementById(index).value == "" && i > 0) {
                var hideThisRow = row + i;
                jQuery(hideThisRow).hide();
                if (showIndex == "-1") {
                    showIndex = i;
                }
            }
            var hideThisAnchor = anchor + i;
            jQuery(hideThisAnchor).hide();
        }
    }
    if (showIndex != "-1") {
        var showThis = anchor + showIndex;
        jQuery(showThis).show();
    }
}
function upcomingReservationsExpandAllUpcoming() {
    jQuery(".details").slideDown();
    jQuery(".selectedDetails").removeClass("selectedDetails");
    jQuery(".clickExpand").addClass("selectedExpand");
    return false;
}
function upcomingReservationsCollapseAllUpcoming() {
    jQuery(".selectedExpand").removeClass("selectedExpand");
    jQuery(".selectedDetails").removeClass("selectedDetails");
    jQuery(".details").slideUp();
    return false;
}
function createSlideBar(id, month) {
    jQuery(id).slider({
        minValue: 1,
        maxValue: 4,
        startValue: month,
        steps: 4,
        change: function(e, ui) {
            monthToggle(ui.value);
        }
    });
}
function buildArray(count, arrivalDate, departDate, confirmNum, cancelDate, url, rebookText, miles, folioText, folioURL, i) {
    var tempArr = new Array(count, arrivalDate, departDate, confirmNum, cancelDate, url, rebookText, miles, folioText, folioURL);
    values[i] = tempArr;
}
function monthToggleEarningTab(months) {
    showUpdatingMessage();
    addressfile = G_CONTEXT_PATH + "/com/hilton/hiway/portlets/customer/hhonors/hhonorsActivity/filterEarningHistory.do";
    paramData = {
        filteredMonths: months * 3
    };
    jQuery("#earningHistoryData").load(addressfile, paramData, hideUpdatingMessage);
}
function showUpdatingMessage() {
    jQuery("#updatingBlockOverlay").show();
    jQuery("#updatingBlock").show();
}
function hideUpdatingMessage() {
    jQuery("#updatingBlockOverlay").hide();
    jQuery("#updatingBlock").hide();
}
function monthToggleRedemptionTab(months) {
    showUpdatingMessage();
    addressfile = G_CONTEXT_PATH + "/com/hilton/hiway/portlets/customer/hhonors/hhonorsActivity/filterRedemptionHistory.do";
    paramData = {
        filteredMonths: months * 3
    };
    jQuery("#redemptionHistoryData").load(addressfile, paramData, hideUpdatingMessage);
}
function cxlsMonthToggle(months) {
    showUpdatingMessage();
    addressfile = G_CONTEXT_PATH + "/com/hilton/hiway/portlets/customer/account/pastStaysAndCancellations/filter.do";
    paramData = {
        filteredMonths: months * 3,
        portletType: "pastCancellations"
    };
    jQuery("#pastCancellationsData").load(addressfile, paramData, hideUpdatingMessage);
}
function staysMonthToggle(months) {
    showUpdatingMessage();
    addressfile = G_CONTEXT_PATH + "/com/hilton/hiway/portlets/customer/account/pastStaysAndCancellations/filter.do";
    paramData = {
        filteredMonths: months * 3,
        portletType: "pastStays"
    };
    jQuery("#pastStaysData").load(addressfile, paramData, ajaxPopup);
}
function ajaxPopup() {
    if (!document.getElementsByTagName) {
        return false;
    }
    var lnks = document.getElementsByTagName("a");
    for (var i = 0; i < lnks.length; i++) {
        if (lnks[i].className == "popup") {
            addClassName(lnks[i], "pops");
            lnks[i].onclick = function() {
                openPopup(this.getAttribute("href"));
                return false;
            };
        }
    }
    hideUpdatingMessage();
}
function checkUsername() {
    if (document.getElementById("createReservationUsername") != null) {
        var username = document.getElementById("createReservationUsername").value;
        var origusername = document.getElementById("origUsername");
        if (origusername != null && origusername.value.toUpperCase() == username.toUpperCase()) {
            return false;
        }
        if (username.length > 3 && isNaN(username.charAt(0))) {
            AccountUtils.isUserNameAlreadyInUse(username, showErrorMessage);
        }
    }
}
function ajaxLogin() {
    var username = document.getElementById("logInUserHhonors").value;
    var password = document.getElementById("logInPassPin").value;
    if (username != null && password != null) {
        AccountUtils.ajaxLogin(username, password, document.getElementById("signInRememberMe").checked);
    }
}
function showErrorMessage(flag) {
    var errorDiv = document.getElementById("dwrError");
    if (flag == true) {
        errorDiv.className = "errorListing";
        jQuery("#createReservationUsername").select();
        jQuery("#createReservationUsername").focus();
    } else {
        errorDiv.className = "hide";
    }
}
function clearMessage() {
    var errorDiv = document.getElementById("dwrError");
    if (errorDiv.className == "errorListing") {
        errorDiv.className = "hide";
    }
}
function showHelperMessageForLanguageChange(defaultValue) {
    var newValue = jQuery("select#personalInformationDefaultLanguage").val();
    jQuery("div.personalInformationDefaultLanguageChange").hide();
    if (defaultValue != newValue) {
        jQuery("#" + newValue).show();
    }
}
function formatPaymentExpField(expDateField) {
    jQuery(expDateField).val(formatMY(jQuery(expDateField).val()));
}
function formatMY(str) {
    var my = new Array();
    if (str.indexOf("\\") != -1) {
        my = str.split("\\");
    } else {
        if (str.indexOf("/") != -1) {
            my = str.split("/");
        } else {
            if (str.indexOf(".") != -1) {
                my = str.split(".");
            } else {
                if (str.indexOf("-") != -1) {
                    my = str.split("-");
                } else {
                    return str;
                }
            }
        }
    }
    if (my[0] != null && my[1] != null) {
        if (my[0].length < 2) {
            my[0] = "0" + my[0];
        }
        if (my[1].length < 3) {
            if (my[1].length == 1) {
                my[1] = "0" + my[1];
            }
            if (my[1].charAt(0) != "9" && my[1].charAt(0) != "8") {
                my[1] = "20" + my[1];
            } else {
                my[1] = "19" + my[1];
            }
        }
        var show = my[0] + "/" + my[1];
        return show;
    } else {
        return str;
    }
}
function setClientDate(ele) {
    jQuery(ele).val(new Date().getTime());
}
/*############ End common/js/plug/account.js ############*/
/*############ Begin common/js/plug/customerservice.js ############*/
jQuery(document).ready(function() {
    var myEnquiry = jQuery("select#csvEnquiryType").val();
    handleTheEnquiryType(myEnquiry);
    jQuery("select#csvEnquiryType").change(function() {
        handleTheEnquiryType(this.options[this.selectedIndex].value);
    });
    jQuery("div.csvRatesClaim").hide();
    jQuery("#csvRatesClaimCountry").hide();
    jQuery("div#hiddenSubmitButton").hide();
});
function handleTheEnquiryType(ind) {
    var pathToForms = G_CONTEXT_PATH + "/portlets/customer/customerService/contact/contactForms/inc_contact_";
    var paramData = {
        countryCode: jQuery("#countryCode").val(),
        freqFlyerNumber: jQuery("#freqFlyerNumber").val(),
        confNum: jQuery("#confNum").val(),
        hotelName: jQuery("#hotelName").val(),
        arrDate: jQuery("#arrDate").val(),
        depDate: jQuery("#depDate").val(),
        comments: jQuery("#comments").val()
    };
    if (ind) {
        jQuery("#csvAddFormContent").load(pathToForms + ind + ".jsp", paramData,
        function() {
            jQuery("a.thickbox").each(function() {
                var rel = jQuery(this).attr("rel");
                jQuery(this).attr("href", rel);
            });
            if ("technicalSupport" == ind) {
                executeHardwareInformation();
            } else {
                if ("recentStayComments" == ind) {
                    YAHOO.customer.cal.init();
                    jQuery("#csvConfirmationNumber").focus();
                }
            }
            jQuery("div#hiddenSubmitButton").show();
        });
    } else {
        jQuery("div#csvAddFormContent").empty();
        jQuery("div#hiddenSubmitButton").hide();
    }
}
function executeHardwareInformation() {
    var OSNumber = 1;
    var browser = 8;
    var compType = 3;
    var version = navigator.appVersion.substring(0, 3);
    var userAgent = navigator.userAgent;
    if (userAgent.indexOf("MSIE") != -1) {
        var start = navigator.appVersion.indexOf("MSIE") + 5;
        var version = navigator.appVersion.substring(start, start + 3);
        browser = 1;
    } else {
        if (userAgent.indexOf("Firefox") != -1) {
            browser = 2;
            if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
                version = new Number(RegExp.$1);
            }
        } else {
            if (userAgent.indexOf("Netscape") != -1) {
                browser = 3;
            } else {
                if (userAgent.indexOf("seamonkey") != -1) {
                    browser = 4;
                } else {
                    if (userAgent.indexOf("Safari") != -1) {
                        browser = 5;
                    } else {
                        if (userAgent.indexOf("Opera") != -1) {
                            browser = 6;
                        } else {
                            if (userAgent.indexOf("WebTV") != -1) {
                                browser = 7;
                            } else {
                                browser = 8;
                            }
                        }
                    }
                }
            }
        }
    }
    if (userAgent.indexOf("Win") != -1) {
        if (userAgent.indexOf("NT") != -1) {
            var winVersion = userAgent.substring(userAgent.indexOf("NT") + 3, userAgent.indexOf("NT") + 6);
            if (winVersion > 5.1) {
                OSNumber = 1;
            }
            if (winVersion == 5.2) {
                OSNumber = 2;
            }
            if (winVersion == 5.1) {
                OSNumber = 3;
            }
            if (winVersion < 5.1) {
                OSNumber = 4;
            }
            if (winVersion == 4) {
                OSNumber = 5;
            }
        } else {
            if (userAgent.indexOf("98") != -1) {
                OSNumber = 6;
            } else {
                if (userAgent.indexOf("95") != -1) {
                    OSNumber = 7;
                } else {
                    OSNumber = 11;
                }
            }
        }
        compType = 1;
    } else {
        if (userAgent.indexOf("Mac") != -1) {
            OSNumber = 1;
            compType = 2;
        } else {
            if (userAgent.indexOf("Linux") != -1) {
                OSNumber = 1;
            } else {
                if (userAgent.indexOf("SCO") != -1) {
                    OSNumber = 2;
                } else {
                    OSNumber = 3;
                }
            }
        }
    }
    document.getElementById("csvComputerType").selectedIndex = compType;
    var osTag = changeOSType();
    document.getElementById(osTag).selectedIndex = OSNumber;
    document.getElementById("csvBrowserName").selectedIndex = browser;
    document.getElementById("csvBrowserVersion").value = version;
}
function changeOSType() {
    jQuery("#csvOperatingSystem").hide();
    jQuery("#csvWindowsOperatingSystem").hide();
    jQuery("#csvMacOperatingSystem").hide();
    jQuery("#csvUnixOperatingSystem").hide();
    var ind = jQuery("select#csvComputerType").val();
    switch (ind) {
    case "PC":
        jQuery("#csvWindowsOperatingSystem").show();
        document.getElementById("csvWindowsOperatingSystem").selectedIndex = 0;
        return "csvWindowsOperatingSystem";
        break;
    case "Apple":
        jQuery("#csvMacOperatingSystem").show();
        document.getElementById("csvMacOperatingSystem").selectedIndex = 0;
        return "csvMacOperatingSystem";
        break;
    case "Unix":
        jQuery("#csvUnixOperatingSystem").show();
        document.getElementById("csvUnixOperatingSystem").selectedIndex = 0;
        return "csvUnixOperatingSystem";
        break;
    }
    jQuery("#csvOperatingSystem").show();
    document.getElementById("csvOperatingSystem").selectedIndex = 0;
    return "csvOperatingSystem";
}
function csvBestRatesClaimForm() {
    jQuery("div.csvRatesClaim").show();
    jQuery("div.csvBestRatesInfo").hide();
}
function csvBestRatesClaimInfo() {
    jQuery("div.csvRatesClaim").hide();
    jQuery("div.csvBestRatesInfo").show();
}
function csvRatesClaimChangeMyCountry() {
    jQuery("#csvRatesClaimCountry").show();
    jQuery("#csvRatesClaimMyCountry").hide();
    jQuery("select#csvRatesClaimSelectCountry").animate({
        backgroundColor: "gold"
    },
    0).animate({
        backgroundColor: "white"
    },
    1000);
    return false;
}
function limitText(limitField) {
    var limitNum = 2000;
    var remainingChar = limitNum - limitField.value.length;
    document.getElementById("remainingCharacters").innerHTML = remainingChar;
}
function chooseStay(confirmationNumber, arrivalDate, departDate, hotelName, hotelCity, bookedAmount, currencyCode, lengthOfStay, numberOfGuests) {
    jQuery("#csvConfirmationNumber").val(confirmationNumber);
    jQuery("#custCheckin").val(arrivalDate);
    jQuery("#custCheckout").val(departDate);
    jQuery("#csvHotelName").val(hotelName);
    jQuery("#csvRatesClaimHotelLocation").val(hotelCity);
    jQuery("#csvRatesClaimRoomBookAmount").val(bookedAmount);
    jQuery("#csvRatesClaimRoomBookedCurrency").val(currencyCode);
    jQuery("#csvRatesClaimNightsBooked").val(lengthOfStay);
    jQuery("#csvRatesClaimNumberOfGuests").val(numberOfGuests);
    return false;
}
function chooseHotel(hotelName, hotelCity) {
    jQuery("#csvHotelName").val(hotelName);
    jQuery("#csvRatesClaimHotelLocation").val(hotelCity);
    return false;
}
/*############ End common/js/plug/customerservice.js ############*/
/*############ Begin common/js/plug/footerPullDown.js ############*/
function goToAndClose() {
    jQuery("#brandSelections").hide();
    jQuery("#brandPulldownLink").removeClass("brandPulldownLinkOpened").addClass("brandPulldownLinkClosed");
}
jQuery(document).keydown(function(e) {
    if (e.which == 27) {
        jQuery("#brandSelections").hide();
        jQuery("#brandPulldownLink").removeClass("brandPulldownLinkOpened").addClass("brandPulldownLinkClosed");
    }
});
jQuery(document).ready(function() {
    var brandDropDownParent = jQuery("#hiltonBrandMenu");
    var findBrandDropDown = false;
    brandDropDownParent.click(function() {
        findBrandDropDown = true;
    });
    jQuery(".brandPulldownLinkOpened").click(function() {
        jQuery("#brandSelections").hide();
        jQuery("#brandPulldownLink").removeClass("brandPulldownLinkOpened").addClass("brandPulldownLinkClosed");
        findBrandDropDown = false;
    });
    jQuery(document).click(function() {
        if (!findBrandDropDown) {
            jQuery("#brandSelections").hide();
            jQuery("#brandPulldownLink").removeClass("brandPulldownLinkOpened").addClass("brandPulldownLinkClosed");
            findBrandDropDown = false;
        } else {
            findBrandDropDown = false;
        }
    });
});
function brandMenuToggler() {
    if (jQuery("#brandPulldownLink").hasClass("brandPulldownLinkClosed")) {
        jQuery("#brandSelections").show();
        jQuery("#brandPulldownLink").addClass("brandPulldownLinkOpened").removeClass("brandPulldownLinkClosed");
    } else {
        jQuery("#brandSelections").hide();
        jQuery("#brandPulldownLink").removeClass("brandPulldownLinkOpened").addClass("brandPulldownLinkClosed");
    }
}
/*############ End common/js/plug/footerPullDown.js ############*/
/*############ Begin common/js/plug/footer.js ############*/
jQuery(document).ready(function() {
    jQuery("ul.footerLogos li .footerHover").hover(function() {
        jQuery(this).siblings("span.footerInfoHover").removeClass("hide");
    },
    function() {
        jQuery(this).siblings("span.footerInfoHover").addClass("hide");
    });
    var footerSearch = jQuery("input:text#footerSearch");
    footerSearch.each(function() {
        if (this.value == "") {
            this.value = this.title;
        }
    });
    footerSearch.focus(function() {
        if (this.value == this.title) {
            this.value = "";
        }
    });
    footerSearch.blur(function() {
        if (this.value == "") {
            this.value = this.title;
        }
    });
    jQuery(document).keydown(function(e) {
        if (e.which == 27) {
            footerSearch.blur();
        }
    });
});
function showBrands() {
    jQuery("#brandSelections").show();
}
/*############ End common/js/plug/footer.js ############*/
/*############ Begin common/js/plug/newsSwapper.js ############*/
jQuery(document).ready(function() {
    var container = jQuery("div.newsItemList");
    var elements = jQuery("div.newsItemList").children();
    var elementsFirst = jQuery("div.newsItemList").children(":first");
    var elementsLast = jQuery("div.newsItemList").children(":last");
    var elementsCurrent = jQuery("div.newsItemList").children("current");
    elements.hide();
    elementsFirst.show();
});
var newsTimer;
function showNextNewsElement() {
    if (jQuery("div.newsItemList").children(":visible").is(":last-child")) {
        jQuery("div.newsItemList").children(":last-child").hide();
        jQuery("div.newsItemList").children(":first-child").fadeIn("fast");
    } else {
        jQuery("div.newsItemList").children(":visible").hide().next().fadeIn("fast");
    }
}
function showNextNewsElementLink() {
    if (jQuery("div.newsItemList").children(":visible").is(":last-child")) {
        jQuery("div.newsItemList").children(":last-child").hide();
        jQuery("div.newsItemList").children(":first-child").fadeIn("fast");
    } else {
        jQuery("div.newsItemList").children(":visible").hide().next().fadeIn("fast");
    }
}
function showPrevNewsElement() {
    if (jQuery("div.newsItemList").children(":visible").is(":first-child")) {
        jQuery("div.newsItemList").children(":first-child").hide();
        jQuery("div.newsItemList").children(":last-child").fadeIn("fast");
    } else {
        jQuery("div.newsItemList").children(":visible").hide().prev().fadeIn("fast");
    }
}
function showPrevNewsElementLink() {
    if (jQuery("div.newsItemList").children(":visible").is(":first-child")) {
        jQuery("div.newsItemList").children(":first-child").hide();
        jQuery("div.newsItemList").children(":last-child").fadeIn("fast");
    } else {
        jQuery("div.newsItemList").children(":visible").hide().prev().fadeIn("fast");
    }
}
/*############ End common/js/plug/newsSwapper.js ############*/
/*############ Begin common/js/plug/checkFlash.js ############*/
jQuery(document).ready(function() {
    if (flashInstalled == "true") {
        if (document.getElementById("flashObject")) {
            if (document.getElementById("flashAltImage")) {
                document.getElementById("flashObject").style.display = "block";
            }
        }
    } else {
        if (document.getElementById("messageBlock")) {
            document.getElementById("flashAltImage").style.display = "block";
            document.getElementById("messageBlock").innerHTML = "Please enable Flash for smooth browsing";
        }
    }
});
var FlashDetect = new
function() {
    var self = this;
    self.installed = false;
    self.raw = "";
    self.major = -1;
    self.minor = -1;
    self.revision = -1;
    self.revisionStr = "";
    var activeXDetectRules = [{
        name: "ShockwaveFlash.ShockwaveFlash.7",
        version: function(obj) {
            return getActiveXVersion(obj);
        }
    },
    {
        name: "ShockwaveFlash.ShockwaveFlash.6",
        version: function(obj) {
            var version = "6,0,21";
            try {
                obj.AllowScriptAccess = "always";
                version = getActiveXVersion(obj);
            } catch(err) {}
            return version;
        }
    },
    {
        name: "ShockwaveFlash.ShockwaveFlash",
        version: function(obj) {
            return getActiveXVersion(obj);
        }
    }];
    var getActiveXVersion = function(activeXObj) {
        var version = -1;
        try {
            version = activeXObj.GetVariable("$version");
        } catch(err) {}
        return version;
    };
    var getActiveXObject = function(name) {
        var obj = -1;
        try {
            obj = new ActiveXObject(name);
        } catch(err) {}
        return obj;
    };
    var parseActiveXVersion = function(str) {
        var versionArray = str.split(",");
        return {
            raw: str,
            major: parseInt(versionArray[0].split(" ")[1], 10),
            minor: parseInt(versionArray[1], 10),
            revision: parseInt(versionArray[2], 10),
            revisionStr: versionArray[2]
        };
    };
    var parseStandardVersion = function(str) {
        var descParts = str.split(/ +/);
        var majorMinor = descParts[2].split(/\./);
        var revisionStr = descParts[3];
        return {
            raw: str,
            major: parseInt(majorMinor[0], 10),
            minor: parseInt(majorMinor[1], 10),
            revisionStr: revisionStr,
            revision: parseRevisionStrToInt(revisionStr)
        };
    };
    var parseRevisionStrToInt = function(str) {
        return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
    };
    self.majorAtLeast = function(version) {
        return self.major >= version;
    };
    self.FlashDetect = function() {
        if (navigator.plugins && navigator.plugins.length > 0) {
            var type = "application/x-shockwave-flash";
            var mimeTypes = navigator.mimeTypes;
            if (mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description) {
                var version = mimeTypes[type].enabledPlugin.description;
                var versionObj = parseStandardVersion(version);
                self.raw = versionObj.raw;
                self.major = versionObj.major;
                self.minor = versionObj.minor;
                self.revisionStr = versionObj.revisionStr;
                self.revision = versionObj.revision;
                self.installed = true;
            }
        } else {
            if (navigator.appVersion.indexOf("Mac") == -1 && window.execScript) {
                var version = -1;
                for (var i = 0; i < activeXDetectRules.length && version == -1; i++) {
                    var obj = getActiveXObject(activeXDetectRules[i].name);
                    if (typeof obj == "object") {
                        self.installed = true;
                        version = activeXDetectRules[i].version(obj);
                        if (version != -1) {
                            var versionObj = parseActiveXVersion(version);
                            self.raw = versionObj.raw;
                            self.major = versionObj.major;
                            self.minor = versionObj.minor;
                            self.revision = versionObj.revision;
                            self.revisionStr = versionObj.revisionStr;
                        }
                    }
                }
            }
        }
    } ();
};
FlashDetect.release = "1.0.3";
var flashInstalled;
if (!FlashDetect.installed) {
    flashInstalled = "false";
} else {
    flashInstalled = "true";
}
/*############ End common/js/plug/checkFlash.js ############*/
/*############ Begin common/js/plug/heroPointer.js ############*/
function heroPointer(colBox, altText) {
    jQuery(".heroAttachment").children("div").children("div").removeClass("colBoxOn");
    jQuery(colBox).addClass("colBoxOn");
    var currentRoom = jQuery(colBox).attr("rel");
    jQuery("#heroPointerImages").attr("src", currentRoom);
    jQuery("#heroPointerImages").attr("alt", altText);
}
/*############ End common/js/plug/heroPointer.js ############*/
/*############ Begin common/js/plug/rfp.js ############*/
jQuery(document).ready(function() {
    jQuery("span.layoutDetail").hide();
    jQuery("span.funcroom_type").hover(function() {
        jQuery(this).children("span.layoutDetail").show();
    },
    function() {
        jQuery(this).children("span.layoutDetail").hide();
    });
    var noOfPeople = jQuery("#rfp_no_people");
    if (noOfPeople.val() == "0") {
        noOfPeople.val("");
    }
    var amount = jQuery("#rfp_spend");
    if (amount.val() == "0") {
        amount.val("");
    }
    var rfp_guest_day_use_qty = jQuery("#rfp_guest_day_use_qty");
    if (rfp_guest_day_use_qty.val() == "0") {
        rfp_guest_day_use_qty.val("");
    }
    var rfp_guest_accessible_qty = jQuery("#rfp_guest_accessible_qty");
    if (rfp_guest_accessible_qty.val() == "0") {
        rfp_guest_accessible_qty.val("");
    }
    var rfp_func_daylight_text = jQuery("#rfp_func_daylight_text");
    if (rfp_func_daylight_text.val() == "0") {
        rfp_func_daylight_text.val("");
    }
    var rfp_func_access_text = jQuery("#rfp_func_access_text");
    if (rfp_func_access_text.val() == "0") {
        rfp_func_access_text.val("");
    }
});
function toggleCloserLookPOG(link, openStateTxt1, ClosedStateTxt2) {
    var link = jQuery(link);
    if (link.hasClass("collapsed")) {
        link.text(openStateTxt1);
        link.attr("title", openStateTxt1);
        link.replaceClass("collapsed", "expanded");
        jQuery(link).parent().parent().siblings(".closerLook").slideToggle();
    } else {
        link.text(ClosedStateTxt2);
        link.attr("title", ClosedStateTxt2);
        link.replaceClass("expanded", "collapsed");
        jQuery(link).parent().parent().siblings(".closerLook").slideToggle();
    }
    return false;
}
function limitText(textArea, limitCountSpan, limitNum) {
    var limitField = jQuery(textArea);
    var limitCount = jQuery("#" + limitCountSpan);
    if (limitField.length == 0) {
        return;
    }
    if (limitField.val().length > limitNum) {
        limitField.val(limitField.val().substring(0, limitNum));
    }
    limitCount.html(Number(limitNum) - Number(limitField.val().length));
    if (limitNum - limitField.val().length == 0) {
        limitCount.html("0");
    }
}
function validateEmail(email) {
    hideEnquiryErrorNotification();
    hideErrorKeys(jQuery("#emailValidation"));
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    if (reg.test(email.value) == false) {
        showEnquiryErrorNotification(jQuery("#emailValidation"));
        email.value = "";
        email.focus();
        return false;
    }
    return true;
}
function hideEnquiryErrorNotification() {
    jQuery("#enquiryErrorList").hide();
    jQuery("#enquiryErrorList").children("ul").children("li").hide();
}
function hideErrorKeys(errorKey) {
    errorKey.hide();
}
function showEnquiryErrorNotification(errorKey) {
    jQuery("#enquiryErrorList").show();
    errorKey.show();
}
function checkNumeric(obj, tag, fieldValidation) {
    hideEnquiryErrorNotification();
    hideErrorKeys(jQuery(fieldValidation));
    jQuery(tag).removeClass("error");
    if (!isNumeric(obj.value)) {
        showEnquiryErrorNotification(jQuery(fieldValidation));
        jQuery(tag).addClass("error");
        obj.value = "";
    }
}
function LTrim(str) {
    if (str == null) {
        return null;
    }
    for (var i = 0; str.charAt(i) == " "; i++) {}
    return str.substring(i, str.length);
}
function RTrim(str) {
    if (str == null) {
        return null;
    }
    for (var i = str.length - 1; str.charAt(i) == " "; i--) {}
    return str.substring(0, i + 1);
}
function Trim(str) {
    return LTrim(RTrim(str));
}
function isNull(val) {
    return (val == null);
}
function isInteger(val) {
    if (isBlank(val)) {
        return false;
    }
    for (var i = 0; i < val.length; i++) {
        if (!isDigit(val.charAt(i))) {
            return false;
        }
    }
    return true;
}
function isNumeric(txt) {
    return ValidString(txt, "0123456789");
}
function removeNonAlphaNumericCharacters(phone) {
    if (phone.length > 0) {
        phone = phone.replace(/[^a-zA-Z0-9]/g, "");
    }
    return phone;
}
function validatePhone(phone) {
    hideEnquiryErrorNotification();
    hideErrorKeys(jQuery("#PhoneValidation"));
    var isPhoneNumberValid = false;
    var UNACCEPTED_FIRST_THREE_DIGITS = /911|999|112|110|119|101/;
    var phoneTemp = removeNonAlphaNumericCharacters(phone.value);
    var phoenLength = phoneTemp.length;
    if (phoenLength > 0) {
        var regExCheckNumeric = new RegExp("[^0-9]", "g");
        var isNumeric = regExCheckNumeric.test(phoneTemp);
        if (!isNumeric && phoenLength >= 3) {
            var phoneAreaCode = phoneTemp.substring(0, 3);
            var isAreaCodeValid = phoneAreaCode.search(UNACCEPTED_FIRST_THREE_DIGITS);
            if (isAreaCodeValid == -1) {
                isPhoneNumberValid = true;
            }
        }
    }
    if (!isPhoneNumberValid) {
        showEnquiryErrorNotification(jQuery("#PhoneValidation"));
        phone.value = "";
        phone.focus();
    }
}
function ValidString(ChkString, ValidString) {
    for (i = 0; i < ChkString.length; i++) {
        if (ValidString.indexOf(ChkString.substring(i, i + 1)) == -1) {
            return false;
        }
    }
    return true;
}
function isBlank(val) {
    if (val == null) {
        return true;
    }
    for (var i = 0; i < val.length; i++) {
        if ((val.charAt(i) != " ") && (val.charAt(i) != "\t") && (val.charAt(i) != "\n") && (val.charAt(i) != "\r")) {
            return false;
        }
    }
    return true;
}
function showAndHide(checkbox) {
    if (jQuery(checkbox).attr("checked")) {
        jQuery("#rfp_equipment_screen_toggle").show();
    } else {
        jQuery("#rfp_equipment_screen_toggle").hide();
    }
}
function openPopUp(anchor) {
    var win = window.open(anchor, "", "width=800,height=500,toolbar=no,location=no,status=yes, resizable=yes, scrollbars=yes");
    win.focus();
}
/*############ End common/js/plug/rfp.js ############*/
/*############ Begin common/js/plug/treeview.js ############*/
jQuery(document).ready(function() {
    jQuery(".treenav .expandable").prepend('<div class="hitarea expandable-hitarea"></div>');
    jQuery(".treenav .collapsable").prepend('<div class="hitarea collapsable-hitarea"></div>');
    jQuery(".treenav .expandable ul").css({
        display: "none"
    });
    jQuery(".treenav").treeview({
        collapsed: true,
        animated: "fast",
        prerendered: true,
        persist: "location"
    });
});
/*############ End common/js/plug/treeview.js ############*/
/*############ Begin common/js/plug/search_zero.js ############*/
jQuery(document).ready(function() {
    jQuery("fieldset.tabSection:gt(0)").hide();
    var roomsInd = jQuery("#roomsNumber").val();
    showAppropriateNumberOfRoomRows(roomsInd);
    jQuery("#fsRoomsHHonors").hide();
    var fsCheckRememberMe = jQuery("#fsCheckRememberMe");
    var codeCorporate = jQuery("#specialCodeCorporate");
    var codeTravelAgent = jQuery("#specialCodeTravelAgent");
    if (codeCorporate.length && codeTravelAgent.length) {
        if ((codeCorporate.val().length != 0) || (codeTravelAgent.val().length != 0)) {
            fsCheckRememberMe.css("visibility", "visible");
        }
    }
    showAppropriateLocationTypeFor(jQuery(".radioChoicesDestinationType").find("input[@type=radio]:checked"));
    rewardSearchResetToOneRoomAndOtherToggles(jQuery("#checkRewardSearch")[0]);
});
function showAppropriateLocationTypeFor(radiochoice) {
    var radio = jQuery(radiochoice).val();
    if (radio == "CITY") {
        jQuery("fieldset.tabSection").hide();
        jQuery("fieldset#fsCitySearch").show();
        jQuery("#hotelSearchOneBoxCity").focus();
    }
    if (radio == "AIRPORT") {
        jQuery("fieldset.tabSection").hide();
        jQuery("fieldset#fsAirportSearch").show();
        jQuery("#hotelSearchOneBoxAirport").focus();
    }
    if (radio == "ADDRESS") {
        jQuery("fieldset.tabSection").hide();
        jQuery("fieldset#fsAddressSearch").show();
        jQuery("#hotelSearchOneBoxAddress").focus();
    }
    if (radio == "ATTRACTION") {
        jQuery("fieldset.tabSection").hide();
        jQuery("fieldset#fsAttractionSearch").show();
        jQuery("#hotelSearchOneBoxAttraction").focus();
    }
    if (radio == "HOTEL") {
        jQuery("fieldset.tabSection").hide();
        jQuery("fieldset#fsHotelPropertySearch").show();
        jQuery("#hotelSearchOneBoxHotelProperty").focus();
    }
}
function showAppropriateNumberOfRoomRows(ind) {
    if (ind < 5) {
        jQuery(".roomNumberLabel,.colNumberOfChildren,.colNumberOfAdults,#fsSpecialAccounts").show();
        jQuery("#tableRoomQuantity tbody tr").slice(0, ind).css("display", "");
        jQuery("#tableRoomQuantity tbody tr").slice(ind).css("display", "none");
        jQuery(".roomNumberLabel").show();
        if (ind == 1) {
            jQuery(".roomNumberLabel").hide();
        }
    }
    if (ind >= 5) {
        jQuery("#tableRoomQuantity tbody tr").slice(1).css("display", "none");
        jQuery(".roomNumberLabel,.colNumberOfChildren,.colNumberOfAdults,#fsSpecialAccounts").hide();
    }
}
function rewardSearchResetToOneRoomAndOtherToggles(checkbox) {
    if (jQuery(checkbox).attr("checked")) {
        jQuery("#roomsNumber").val(1);
        showAppropriateNumberOfRoomRows(1);
        jQuery("#fsSpecialCodeCorporate,#fsSpecialCodeTravelAgent,.colNumberOfRooms").hide();
        jQuery("#fsRoomsHHonors").show();
    } else {
        jQuery("#fsSpecialCodeCorporate,#fsSpecialCodeTravelAgent,.colNumberOfRooms").show();
        jQuery("#fsRoomsHHonors").hide();
    }
}
function focusCheckForLength() {
    var fsCheckRememberMe = jQuery("#fsCheckRememberMe");
    var codeCorporate = jQuery("#specialCodeCorporate");
    var codeAffiliate = jQuery("#specialCodeAffiliate");
    var hasFocus = true;
    if (hasFocus || (codeCorporate.val().length != 0) || (codeAffi.val().length != 0)) {
        fsCheckRememberMe.css("visibility", "visible");
    } else {
        fsCheckRememberMe.css("visibility", "hidden");
        jQuery("#checkRememberSpecialCodes").removeAttr("checked");
    }
}
function blurCheckForLength() {
    var fsCheckRememberMe = jQuery("#fsCheckRememberMe");
    var codeCorporate = jQuery("#specialCodeCorporate");
    var codeTravelAgent = jQuery("#specialCodeTravelAgent");
    var hasFocus = false;
    if (hasFocus || (codeCorporate.val().length != 0) || (codeTravelAgent.val().length != 0)) {
        fsCheckRememberMe.css("visibility", "visible");
    } else {
        fsCheckRememberMe.css("visibility", "hidden");
        jQuery("#checkRememberSpecialCodes").removeAttr("checked");
    }
}
function submitFormKeywordSearch() {
    jQuery("#keywordSearchForm").submit();
}
function submitFormSearchHotels() {
    jQuery(".formSearchHotels").submit();
}
/*############ End common/js/plug/search_zero.js ############*/
/*############ Begin common/js/plug/faq.js ############*/
jQuery(document).ready(function() {
    jQuery(".faqShortAnswer").hide();
    jQuery(".faqShortAnswerContainer").hover(function() {
        jQuery(this).children().children(".faqShortAnswerPop").removeClass("hide");
    },
    function() {
        jQuery(this).children().children(".faqShortAnswerPop").addClass("hide");
    });
});
function faqToggler(el) {
    var el = jQuery(el);
    if (jQuery(el).parent().hasClass("faqQuestionClicked")) {
        jQuery(el).siblings(".faqShortAnswer").slideUp();
        jQuery(el).parent().removeClass("faqQuestionClicked");
    } else {
        jQuery(el).parent().addClass("faqQuestionClicked");
        jQuery(el).siblings(".faqShortAnswer").slideDown();
    }
}
/*############ End common/js/plug/faq.js ############*/
/*############ Begin common/js/plug/rfp_validation.js ############*/
function hideEnquiryDateErrorNotification(dateCal) {
    jQuery("#enquiryDateErrorList" + dateCal).hide();
    jQuery("#enquiryDateErrorList" + dateCal).children("ul").children("li").hide();
}
function hideErrorKeys(errorKey) {
    errorKey.hide();
}
function showEnquiryDateErrorNotification(dateCal, errorKey) {
    jQuery("#enquiryDateErrorList" + dateCal).show();
    errorKey.show();
}
function clearCheckinDay(dateCal) {
    jQuery("#checkinDayOfWeekLabel" + dateCal).html("");
}
function clearCheckoutDay(dateCal) {
    jQuery("#checkoutDayOfWeekLabel" + dateCal).html("");
}
function validateDateFormats_rfp(inDateStr, outDateStr, arrivalDateField, departureDateField, dateCal) {
    var validformatInDate = "";
    var validformatOutDate = "";
    if (inDateStr.toString() != "") {
        validformatInDate = datePatternValidation(inDateStr);
    }
    if (outDateStr.toString() != "") {
        validformatOutDate = datePatternValidation(outDateStr);
    }
    if (validformatInDate == "formatnotvalid" || validformatOutDate == "formatnotvalid") {
        if (validformatInDate == "formatnotvalid") {
            clearCheckinDay(dateCal);
            showEnquiryDateErrorNotification(dateCal, jQuery("#arrivalDateNotValid" + dateCal));
            jQuery("#fsCheckin" + dateCal).addClass("error");
            arrivalDateField.focus();
        } else {
            arrivalDateField.val(validformatInDate);
        }
        if (validformatOutDate == "formatnotvalid") {
            clearCheckoutDay(dateCal);
            showEnquiryDateErrorNotification(dateCal, jQuery("#departureDateNotValid" + dateCal));
            jQuery("#fsCheckout" + dateCal).addClass("error");
            departureDateField.focus();
        } else {
            departureDateField.val(validformatOutDate);
        }
        return false;
    }
    return true;
}
function dateChangeValidation_rfp(calId) {
    var locale = G_LOCALE;
    var arrivalDateField = jQuery("#checkin0");
    var departureDateField = jQuery("#checkout0");
    var dateCal = "0";
    if (calId == "calStart1" || calId == "calEnd1") {
        dateCal = "1";
        arrivalDateField = jQuery("#checkin1");
        departureDateField = jQuery("#checkout1");
    } else {
        if (calId == "calStart2" || calId == "calEnd2") {
            dateCal = "2";
            arrivalDateField = jQuery("#checkin2");
            departureDateField = jQuery("#checkout2");
        }
    }
    jQuery("#fsCheckin" + dateCal).removeClass("error");
    jQuery("#fsCheckout" + dateCal).removeClass("error");
    var inDateStr = arrivalDateField.val();
    var outDateStr = departureDateField.val();
    var checkindayofweekField = jQuery("#checkinDayOfWeekLabel" + dateCal);
    var checkoutdayofweekField = jQuery("#checkoutDayOfWeekLabel" + dateCal);
    hideEnquiryDateErrorNotification(dateCal);
    if ((inDateStr == "" || outDateStr == "") && (calId != "calStart2" && calId != "calEnd2")) {
        if (inDateStr == "") {
            clearCheckinDay(dateCal);
            if (calId != "calStart2" && calId != "calEnd2") {
                jQuery("#fsCheckin" + dateCal).addClass("error");
                arrivalDateField.focus();
            }
        }
        if (outDateStr == "") {
            clearCheckoutDay(dateCal);
            if (calId != "calStart2" && calId != "calEnd2") {
                jQuery("#fsCheckout" + dateCal).addClass("error");
                departureDateField.focus();
            }
        }
        if (calId != "calStart2" && calId != "calEnd2") {
            showEnquiryDateErrorNotification(dateCal, jQuery("#dateFieldEmpty" + dateCal));
        }
        return false;
    }
    var validDateFormats = validateDateFormats_rfp(inDateStr, outDateStr, arrivalDateField, departureDateField, dateCal);
    if (validDateFormats == false) {
        return false;
    }
    inDateStr = arrivalDateField.val();
    outDateStr = departureDateField.val();
    if (inDateStr == "" || outDateStr == "") {
        return false;
    }
    var validRange = validateDateRange_rfp(inDateStr, outDateStr, dateCal, calId);
    if (validRange == false) {
        return false;
    }
    jQuery("#fsCheckin" + dateCal).removeClass("error");
    jQuery("#fsCheckout" + dateCal).removeClass("error");
    return true;
}
function validateDateRange_rfp(inDateStr, outDateStr, dateCal, calId) {
    var locale = G_LOCALE;
    if (locale == "en_US") {
        var month = inDateStr.substring(0, 2);
        month--;
        var day = inDateStr.substring(3, 5);
        var year = inDateStr.substring(6);
        var outMonth = outDateStr.substring(0, 2);
        outMonth--;
        var outDay = outDateStr.substring(3, 5);
        var outYear = outDateStr.substring(6);
    } else {
        if (locale == "de_DE" || locale == "en_GB") {
            var month = inDateStr.substring(3, 5);
            month--;
            var day = inDateStr.substring(0, 2);
            var year = inDateStr.substring(6);
            var outMonth = outDateStr.substring(3, 5);
            outMonth--;
            var outDay = outDateStr.substring(2, 0);
            var outYear = outDateStr.substring(6);
        } else {
            if (locale == "ja_JP") {
                var month = inDateStr.substring(5, 7);
                month--;
                var day = inDateStr.substring(8);
                var year = inDateStr.substring(0, 4);
                var outMonth = outDateStr.substring(5, 7);
                outMonth--;
                var outDay = outDateStr.substring(8);
                var outYear = outDateStr.substring(0, 4);
            }
        }
    }
    var d1 = new Date();
    d1.setFullYear(year, month, day);
    var today = new Date();
    if (today > d1) {
        showEnquiryDateErrorNotification(dateCal, jQuery("#arrivalDateEarlierThanToday" + dateCal));
        jQuery("#fsCheckin" + dateCal).addClass("error");
        return false;
    }
    var d2 = new Date();
    d2.setFullYear(outYear, outMonth, outDay);
    if ((outMonth == month) && (outYear == year) && (outDay == day)) {
        updateCheckindayofweek_rfp(d1, locale, dateCal);
        updateCheckoutdayofweek_rfp(d2, locale, dateCal);
        return true;
    } else {
        if (d2 > d1) {
            updateCheckindayofweek_rfp(d1, locale, dateCal);
            updateCheckoutdayofweek_rfp(d2, locale, dateCal);
            return true;
        } else {
            updateCheckindayofweek_rfp(d1, locale, dateCal);
            if (calId == "calStart0" || calId == "calEnd0") {
                if (calId == "calStart0") {
                    updateDepartureDate_rfp(locale, year, month, day, dateCal);
                } else {
                    showEnquiryDateErrorNotification(dateCal, jQuery("#departureLaterThanArrival" + dateCal));
                    jQuery("#fsCheckout" + dateCal).addClass("error");
                    return false;
                }
            } else {
                if (calId == "calStart1" || calId == "calEnd1") {
                    if (calId == "calStart1") {
                        updateDepartureDate_rfp(locale, year, month, day, dateCal);
                    } else {
                        showEnquiryDateErrorNotification(dateCal, jQuery("#departureLaterThanArrival" + dateCal));
                        jQuery("#fsCheckout" + dateCal).addClass("error");
                        return false;
                    }
                } else {
                    if (calId == "calStart2" || calId == "calEnd2") {
                        if (calId == "calStart2") {
                            updateDepartureDate_rfp(locale, year, month, day, dateCal);
                        } else {
                            showEnquiryDateErrorNotification(dateCal, jQuery("#departureLaterThanArrival" + dateCal));
                            return false;
                        }
                    }
                }
            }
            return true;
        }
    }
    return true;
}
function updateCheckindayofweek_rfp(today, locale, dateCal) {
    var checkindayofweekField = jQuery("#checkinDayOfWeekLabel" + dateCal);
    if (locale == "en_US" || locale == "en_GB") {
        var weekday = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
        checkindayofweekField.html(weekday[today.getDay()]);
    }
    if (locale == "de_DE") {
        var weekday = new Array("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag");
        checkindayofweekField.html(weekday[today.getDay()]);
    }
    if (locale == "ja_JP") {
        var weekdayJP = new Array("\u65E5", "\u6708", "\u706B", "\u6C34", "\u6728", "\u91D1", "\u571F");
        checkindayofweekField.html(weekdayJP[today.getDay()]);
    }
}
function isLeapYear(date) {
    var locale = G_LOCALE;
    var formatedDate = reformatDate(date);
    if (locale == "ja_JP") {
        var year = formatedDate.substring(0, 4);
    } else {
        var year = formatedDate.substring(6);
    }
    return new Date(year, 2 - 1, 29).getDate() == 29;
}
function updateDepartureDate_rfp(locale, year, month, day, dateCal) {
    var checkoutdayofweekField = jQuery("#checkoutDayOfWeekLabel" + dateCal);
    var departureDateField = jQuery("#checkout" + dateCal);
    var date = new Date();
    date.setFullYear(year, month, day);
    date.setDate(date.getDate() + 1);
    month = date.getMonth();
    day = date.getDate();
    year = date.getFullYear();
    month++;
    day = addLeadingZero(day);
    month = addLeadingZero(month);
    if (locale == "en_US") {
        departureDateField.val(month + "/" + day + "/" + year);
        month--;
        date.setFullYear(year, month, day);
        updateCheckoutdayofweek_rfp(date, locale, dateCal);
    }
    if (locale == "en_GB") {
        departureDateField.val(day + "/" + month + "/" + year);
        month--;
        date.setFullYear(year, month, day);
        updateCheckoutdayofweek_rfp(date, "en_GB", dateCal);
    }
    if (locale == "de_DE") {
        departureDateField.val(day + "." + month + "." + year);
        month--;
        date.setFullYear(year, month, day);
        updateCheckoutdayofweek_rfp(date, "de_DE", dateCal);
    }
    if (locale == "ja_JP") {
        departureDateField.val(year + "/" + month + "/" + day);
        month--;
        date.setFullYear(year, month, day);
        updateCheckoutdayofweek_rfp(date, "ja_JP", dateCal);
    }
    updateCalendarSelectedDate_RFP("", "", "calEnd" + dateCal);
}
function updateNumberOfNights(nbr, dateCal) {
    if (!jQuery("#nightStayText" + dateCal)) {
        return;
    }
    var nightStayText = jQuery("#nightStayText" + dateCal).html();
    var zeroNightStayText = jQuery("#zeroNightStayText" + dateCal).html();
    if (nbr > 0) {
        jQuery("#numberOfNights" + dateCal).html("<span id='numberOfNightsSpan'+dateCal></span> " + nightStayText);
        jQuery("#numberOfNightsSpan" + dateCal).html(nbr);
    } else {
        if (nbr == 0) {
            jQuery("#numberOfNights" + dateCal).html(zeroNightStayText);
        } else {
            jQuery("#numberOfNights" + dateCal).html("");
        }
    }
}
function updateCheckoutdayofweek_rfp(tomorrow, locale, dateCal) {
    var checkoutdayofweekField = jQuery("#checkoutDayOfWeekLabel" + dateCal);
    if (locale == "en_US" || locale == "en_GB") {
        var weekday = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
        checkoutdayofweekField.html(weekday[tomorrow.getDay()]);
    }
    if (locale == "de_DE") {
        var weekday = new Array("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag");
        checkoutdayofweekField.html(weekday[tomorrow.getDay()]);
    }
    if (locale == "ja_JP") {
        var weekday = new Array("\u65E5", "\u6708", "\u706B", "\u6C34", "\u6728", "\u91D1", "\u571F");
        checkoutdayofweekField.html(weekday[tomorrow.getDay()]);
    }
}
function datePatternValidation(dateStr) {
    dateStr = dateStr.toString();
    var locale = G_LOCALE;
    if (locale == "ja_JP") {
        if (/^(\d{2})[\/.\\](\d{1})[\/.\\]\d{1}$/.test(dateStr) || /^(\d{2})[\/.\\](\d{2})[\/.\\]\d{1}$/.test(dateStr) || /^(\d{2})[\/.\\](\d{1})[\/.\\]\d{2}$/.test(dateStr) || /^(\d{2})[\/.\\](\d{2})[\/.\\]\d{2}$/.test(dateStr) || /^(\d{4})[\/.\\](\d{2})[\/.\\]\d{2}$/.test(dateStr) || /^(\d{4})[\/.\\](\d{1})[\/.\\]\d{1}$/.test(dateStr) || /^(\d{4})[\/.\\](\d{2})[\/.\\]\d{1}$/.test(dateStr) || /^(\d{4})[\/.\\](\d{1})[\/.\\]\d{2}$/.test(dateStr)) {
            if (RegExp.$3 * 1 > 31) {
                return "formatnotvalid";
            }
            if (RegExp.$2 * 1 > 12) {
                return "formatnotvalid";
            }
            if ((RegExp.$2 * 1 == 2) || (RegExp.$2 * 1 == 4) || (RegExp.$2 * 1 == 6) || (RegExp.$2 * 1 == 9) || (RegExp.$2 * 1 == 11)) {
                if (RegExp.$3 * 1 > 30) {
                    return "formatnotvalid";
                }
            }
            if (RegExp.$2 * 1 == 2) {
                if (RegExp.$3 * 1 > 29) {
                    return "formatnotvalid";
                }
            }
            if (RegExp.$2 * 1 == 2) {
                if (!isLeapYear(dateStr)) {
                    if (RegExp.$3 * 1 > 28) {
                        return "formatnotvalid";
                    }
                }
            }
            return reformatDate(dateStr);
        } else {
            return "formatnotvalid";
        }
    }
    if (/^(\d{2})[\/.\\](\d{1})[\/.\\]\d{2}$/.test(dateStr) || /^(\d{1})[\/.\\](\d{2})[\/.\\]\d{2}$/.test(dateStr) || /^(\d{1})[\/.\\](\d{1})[\/.\\]\d{2}$/.test(dateStr) || /^(\d{2})[\/.\\](\d{2})[\/.\\]\d{2}$/.test(dateStr) || /^(\d{2})[\/.\\](\d{2})[\/.\\]\d{4}$/.test(dateStr) || /^(\d{1})[\/.\\](\d{1})[\/.\\]\d{4}$/.test(dateStr) || /^(\d{1})[\/.\\](\d{2})[\/.\\]\d{4}$/.test(dateStr) || /^(\d{2})[\/.\\](\d{1})[\/.\\]\d{4}$/.test(dateStr)) {
        if (locale == "en_US") {
            if (RegExp.$2 * 1 > 31) {
                return "formatnotvalid";
            }
            if (RegExp.$1 * 1 > 12) {
                return "formatnotvalid";
            }
            if ((RegExp.$1 * 1 == 2) || (RegExp.$1 * 1 == 4) || (RegExp.$1 * 1 == 6) || (RegExp.$1 * 1 == 9) || (RegExp.$1 * 1 == 11)) {
                if (RegExp.$2 * 1 > 30) {
                    return "formatnotvalid";
                }
            }
            if (RegExp.$1 * 1 == 2) {
                if (RegExp.$2 * 1 > 29) {
                    return "formatnotvalid";
                }
            }
            if (RegExp.$1 * 1 == 2) {
                if (!isLeapYear(dateStr)) {
                    if (RegExp.$2 * 1 > 28) {
                        return "formatnotvalid";
                    }
                }
            }
        }
        if (locale == "de_DE" || locale == "en_GB") {
            if (RegExp.$1 * 1 > 31) {
                return "formatnotvalid";
            }
            if (RegExp.$2 * 1 > 12) {
                return "formatnotvalid";
            }
            if ((RegExp.$2 * 1 == 2) || (RegExp.$2 * 1 == 4) || (RegExp.$2 * 1 == 6) || (RegExp.$2 * 1 == 9) || (RegExp.$2 * 1 == 11)) {
                if (RegExp.$1 * 1 > 30) {
                    return "formatnotvalid";
                }
            }
            if (RegExp.$2 * 1 == 2) {
                if (RegExp.$1 * 1 > 29) {
                    return "formatnotvalid";
                }
            }
            if (RegExp.$2 * 1 == 2) {
                if (!isLeapYear(dateStr)) {
                    if (RegExp.$1 * 1 > 28) {
                        return "formatnotvalid";
                    }
                }
            }
        }
        return reformatDate(dateStr);
    } else {
        return "formatnotvalid";
    }
}
/*############ End common/js/plug/rfp_validation.js ############*/
/*############ Begin common/js/plug/eventSpaceFinder.js ############*/
jQuery(document).ready(function() {
    jQuery(".imperial").hide();
    jQuery("span.detail").hide();
    jQuery("div.eventSpaceOption").hover(function() {
        jQuery(this).children("span.detail").show();
    },
    function() {
        jQuery(this).children("span.detail").hide();
    });
});
var calculateUnit = true;
var roomSelected = null;
function switchSelection() {
    if (calculateUnit) {
        jQuery(".imperial").show();
        jQuery(".metric").hide();
        calculateUnit = false;
    } else {
        jQuery(".metric").show();
        jQuery(".imperial").hide();
        calculateUnit = true;
    }
    resetSelection();
}
function resetSelection() {
    jQuery("#answerRm").hide();
    jQuery("#rmSize").val("");
    jQuery("#answerPpl").hide();
    jQuery("#ppl").val("");
    jQuery(".error").hide();
    jQuery("#roomLayouts").removeClass("error");
    jQuery("#roomLayouts").show();
}
function checkRadioSelection(layoutName) {
    roomSelected = layoutName;
}
function getPpl() {
    if (roomSelected == null) {
        jQuery("#roomLayouts").addClass("error");
    } else {
        rs = jQuery(".rmSize").val();
        jQuery("#answerRm").hide();
        jQuery("#roomLayouts").removeClass("error");
        if (rs == "" || validate(rs)) {
            jQuery("#eventOption1").addClass("error");
        } else {
            jQuery("#eventOption1").removeClass("error");
            jQuery(".error").hide();
            jQuery("#eventOption1").show();
            jQuery("#eventOption2").show();
            var nogo = 0;
            var i = 0;
            if (!calculateUnit) {
                if (roomSelected > 0) {
                    switch (roomSelected) {
                    case "2":
                        if (rs > 1000) {
                            jQuery("#confErrorRmSizeFt").show();
                            nogo = 1;
                        }
                        break;
                    case "5":
                        if (rs > 2000 || rs < 300) {
                            jQuery("#hsquareErrorRmSizeFt").show();
                            nogo = 1;
                        }
                        break;
                    default:
                        nogo = 0;
                    }
                }
                switch (roomSelected) {
                case "1":
                    i = 0.0832;
                    break;
                case "2":
                    i = 0.024;
                    break;
                case "3":
                    i = 0.0389;
                    break;
                case "4":
                    i = 0.04163;
                    break;
                case "5":
                    i = 0.024;
                    break;
                case "6":
                    i = 0.1;
                    break;
                case "7":
                    i = 0.0286;
                    break;
                case "8":
                    i = 0.111;
                    break;
                default:
                    i = 0;
                }
            } else {
                if (roomSelected > 0) {
                    roomSelected = roomSelected;
                    switch (roomSelected) {
                    case "2":
                        if (rs > 90) {
                            jQuery("#confErrorRmSizeM").show();
                            nogo = 1;
                        }
                        break;
                    case "5":
                        if (rs > 186 || rs < 36) {
                            jQuery("#hsquareErrorRmSizeM").show();
                            nogo = 1;
                        }
                        break;
                    default:
                        nogo = 0;
                    }
                }
                switch (roomSelected) {
                case "1":
                    i = 0.894599;
                    break;
                case "2":
                    i = 0.26798;
                    break;
                case "3":
                    i = 0.419412;
                    break;
                case "4":
                    i = 0.448102;
                    break;
                case "5":
                    i = 0.279865;
                    break;
                case "6":
                    i = 1.136669;
                    break;
                case "7":
                    i = 0.30754;
                    break;
                case "8":
                    i = 1.194795;
                    break;
                default:
                    i = 0;
                }
            }
            if (nogo != 1) {
                peeps = rs * i;
                peeps = Math.round(peeps);
                jQuery("#reload").html(peeps);
                jQuery("#answerRm").show();
            }
        }
    }
}
function getRm() {
    var labelForUnit;
    if (roomSelected == null) {
        jQuery("#roomLayouts").addClass("error");
    } else {
        pp = jQuery("#ppl").val();
        jQuery("#answerPpl").hide();
        jQuery("#roomLayouts").removeClass("error");
        if (pp == "" || validate(pp)) {
            jQuery("#eventOption2").addClass("error");
        } else {
            jQuery("#eventOption2").removeClass("error");
            jQuery(".error").hide();
            jQuery("#eventOption1").show();
            jQuery("#eventOption2").show();
            var nogo = 0;
            var i = 0;
            if (roomSelected > 0) {
                switch (roomSelected) {
                case "2":
                    if (pp > 24) {
                        jQuery("#confErrorPplSize").show();
                        nogo = 1;
                    }
                    break;
                case "5":
                    if (pp > 52 || pp < 10) {
                        jQuery("#hsquareErrorPplSize").show();
                        nogo = 1;
                    }
                    break;
                default:
                    nogo = 0;
                }
            }
            if (!calculateUnit) {
                switch (roomSelected) {
                case "1":
                    i = 12.0321;
                    break;
                case "2":
                    i = 40.16667;
                    break;
                case "3":
                    i = 25.664241;
                    break;
                case "4":
                    i = 24.0211;
                    break;
                case "5":
                    i = 38.461;
                    break;
                case "6":
                    i = 9.46969;
                    break;
                case "7":
                    i = 35;
                    break;
                case "8":
                    i = 9.009;
                    break;
                default:
                    i = 0;
                }
            } else {
                switch (roomSelected) {
                case "1":
                    i = 1.117818667584;
                    break;
                case "2":
                    i = 3.7316057496768;
                    break;
                case "3":
                    i = 2.38428600819264;
                    break;
                case "4":
                    i = 2.231633214144;
                    break;
                case "5":
                    i = 3.57314382144;
                    break;
                case "6":
                    i = 0.8797629888576;
                    break;
                case "7":
                    i = 3.2516064;
                    break;
                case "8":
                    i = 0.83696348736;
                    break;
                default:
                    i = 0;
                }
            }
            if (nogo != 1) {
                room = pp * i;
                room = Math.round(room);
                if (calculateUnit) {
                    jQuery("#reloadRmM").show();
                    jQuery("#reloadRmFt").hide();
                } else {
                    jQuery("#reloadRmFt").show();
                    jQuery("#reloadRmM").hide();
                }
                jQuery("#answerPplVal").html(room);
                jQuery("#answerPpl").show();
            }
        }
    }
}
function validate(tempnum) {
    var valid = "0123456789.";
    var mynum = eval(tempnum.length);
    var ok = "yes";
    var temp;
    if (tempnum == "0") {
        ok = "no";
    } else {
        for (var i = 0; i < mynum; i++) {
            temp = "" + tempnum.substring(i, i + 1);
            if (valid.indexOf(temp) == "-1") {
                ok = "no";
            }
        }
    }
    return (ok == "no") ? true: false;
}
/*############ End common/js/plug/eventSpaceFinder.js ############*/
/*############ Begin common/js/plug/yuiCal_search.js ############*/
YAHOO.namespace("search.cal");
YAHOO.search.cal.CAL_CONFIG = {
    DATE_FORMAT_STRING: G_DATE_FORMAT_SHORT,
    START_WEEKDAY: 0,
    ARRIVAL_TITLE: G_CAL_ARRIVAL,
    DEPARTURE_TITLE: G_CAL_DEPARTURE,
    MONTHS_LONG: G_MONTHS,
    WEEKDAYS_SHORT: G_CAL_SHORT_WEEKDAYS,
    YUI_DATE_FORMAT_STRING: "MM/dd/yyyy",
    YUI_PAGE_DATE_FORMAT_STRING: "MM/yyyy",
    SOFT_SELECT_CLASS: "softSelectedDate",
    CHECKIN_CAL_ID: "searchCheckinCal",
    CHECKIN_CAL_CONTAINER: "searchCheckinCalContainer",
    CHECKIN_CAL_ICON: "searchIcoCalCheckIn",
    CHECKIN_TEXT_BOX: "searchCheckin",
    CHECKIN_DAY_NAME_LABEL: "searchCheckinDayOfWeekLabel",
    CHECKIN_FIELDSET: "fsCheckin",
    CHECKIN_CAL_OPEN: false,
    CHECKOUT_CAL_ID: "searchCheckoutCal",
    CHECKOUT_CAL_CONTAINER: "searchCheckoutCalContainer",
    CHECKOUT_CAL_ICON: "searchIcoCalCheckOut",
    CHECKOUT_TEXT_BOX: "searchCheckout",
    CHECKOUT_DAY_NAME_LABEL: "searchCheckoutDayOfWeekLabel",
    CHECKOUT_FIELDSET: "fsCheckout",
    CHECKOUT_CAL_OPEN: false,
    DATES_FIELDSET: "fsDates",
    NUMBER_OF_NIGHTS_P: "numberOfNights",
    NUMBER_OF_NIGHTS_SPAN: "numberOfNightsSpan",
    NIGHT_STAY_TEXT: "nightStayText",
    ZERO_NIGHT_STAY_TEXT: "zeroNightStayText",
    DEPARTURE_FROM_ARRIVAL_RANGE: 90,
    REWARDS_DEPARTURE_FROM_ARRIVAL_RANGE: 90,
    REWARDS_CHECKBOX: "checkRewardSearch",
    ARRIVAL_FROM_TODAY_RANGE: 729
};
YAHOO.search.cal.ERROR_CONFIG = {
    ERROR_LIST_ID: "datesErrorList",
    ERROR_ARRIVAL_DATE_EMPTY: "arrivalDateFieldEmpty",
    ERROR_ARRIVAL_DATE_EARLIER: "arrivalDateEarlierThanToday",
    ERROR_ARRIVAL_DATE_INVALID: "arrivalDateNotValid",
    ERROR_ARRIVAL_DATE_TOO_FAR: "reservationBeyondTwoYears",
    ERROR_DEPARTURE_DATE_EMPTY: "departureDateFieldEmpty",
    ERROR_DEPARTURE_DATE_BEFORE: "departureBeforeArrival",
    ERROR_DEPARTURE_DATE_INVALID: "departureDateNotValid",
    ERROR_DEPARTURE_TOO_FAR: "departureDateTooFar",
    ERROR_DEPARTURE_HHONORS_RANGE: "hhonorsRewardRange",
    CHECKIN_ERROR_CLASS: "arrivalError",
    CHECKOUT_ERROR_CLASS: "departureError"
};
Date.preferAmericanFormat = false;
Date.dayNames = G_WEEKDAYS;
YAHOO.search.cal.init = function() {
    var minArrivalDate = new Date();
    var minDepartureDate = new Date();
    var maxArrivalDate = new Date().add("d", YAHOO.search.cal.CAL_CONFIG.ARRIVAL_FROM_TODAY_RANGE);
    var maxDepartureDate = new Date().add("d", YAHOO.search.cal.CAL_CONFIG.DEPARTURE_FROM_ARRIVAL_RANGE);
    var selectedDepartureDate = new Date().add("d", 1);
    if (YAHOO.search.cal.getCheckinDate() != null) {
        maxDepartureDate = YAHOO.search.cal.getCheckinDate().add("d", YAHOO.search.cal.CAL_CONFIG.DEPARTURE_FROM_ARRIVAL_RANGE);
        minDepartureDate = YAHOO.search.cal.getCheckinDate();
    }
    if (YAHOO.search.cal.getCheckoutDate() != null) {
        selectedDepartureDate = YAHOO.search.cal.getCheckoutDate();
    }
    
    /*
     * Init the calendars
     */
    YAHOO.search.cal.checkinCal = new YAHOO.widget.CalendarGroup(YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_ID, YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_CONTAINER, {
        MULTI_SELECT: false,
        PAGES: 2,
        CLOSE: true,
        IFRAME: true,
        MINDATE: minArrivalDate,
        MAXDATE: maxArrivalDate,
        SELECTED: minArrivalDate.format(YAHOO.search.cal.CAL_CONFIG.DATE_FORMAT_STRING),
        TITLE: YAHOO.search.cal.CAL_CONFIG.ARRIVAL_TITLE,
        START_WEEKDAY: YAHOO.search.cal.CAL_CONFIG.START_WEEKDAY,
        MONTHS_LONG: YAHOO.search.cal.CAL_CONFIG.MONTHS_LONG,
        WEEKDAYS_SHORT: YAHOO.search.cal.CAL_CONFIG.WEEKDAYS_SHORT
    });
    YAHOO.search.cal.checkoutCal = new YAHOO.widget.CalendarGroup(YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_ID, YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_CONTAINER, {
        MULTI_SELECT: false,
        PAGES: 2,
        CLOSE: true,
        IFRAME: true,
        MINDATE: minDepartureDate,
        MAXDATE: maxDepartureDate,
        SELECTED: selectedDepartureDate.format(YAHOO.search.cal.CAL_CONFIG.DATE_FORMAT_STRING),
        TITLE: YAHOO.search.cal.CAL_CONFIG.DEPARTURE_TITLE,
        START_WEEKDAY: YAHOO.search.cal.CAL_CONFIG.START_WEEKDAY,
        MONTHS_LONG: YAHOO.search.cal.CAL_CONFIG.MONTHS_LONG,
        WEEKDAYS_SHORT: YAHOO.search.cal.CAL_CONFIG.WEEKDAYS_SHORT
    });
    YAHOO.search.cal.checkinCal.render();
    YAHOO.search.cal.checkoutCal.render();
    
    /*
     * Add event listeners
     */
    YAHOO.util.Event.addListener(YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_ICON, "click", YAHOO.search.cal.checkinCal.show, YAHOO.search.cal.checkinCal, true);
    YAHOO.util.Event.addListener(YAHOO.search.cal.CAL_CONFIG.CHECKIN_TEXT_BOX, "click", YAHOO.search.cal.checkinCal.show, YAHOO.search.cal.checkinCal, true);
    YAHOO.util.Event.addListener(YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_ICON, "click", YAHOO.search.cal.checkoutCal.show, YAHOO.search.cal.checkoutCal, true);
    YAHOO.util.Event.addListener(YAHOO.search.cal.CAL_CONFIG.CHECKOUT_TEXT_BOX, "click", YAHOO.search.cal.checkoutCal.show, YAHOO.search.cal.checkoutCal, true);
    YAHOO.util.Event.addListener(YAHOO.search.cal.CAL_CONFIG.CHECKOUT_TEXT_BOX, "change", YAHOO.search.cal.validateCheckoutDate);
    YAHOO.util.Event.addListener(YAHOO.search.cal.CAL_CONFIG.CHECKIN_TEXT_BOX, "change", YAHOO.search.cal.validateCheckinDate);

    YAHOO.search.cal.checkoutCal.beforeShowEvent.subscribe(YAHOO.search.cal.hideOtherCalendar, YAHOO.search.cal.checkoutCal, true);
    YAHOO.search.cal.checkoutCal.beforeShowEvent.subscribe(YAHOO.search.cal.addSoftSelectedDate, YAHOO.search.cal.checkoutCal, true);
    
    YAHOO.search.cal.checkoutCal.changePageEvent.subscribe(YAHOO.search.cal.addSoftSelectedDate, YAHOO.search.cal.checkoutCal, true);
    YAHOO.search.cal.checkoutCal.hideEvent.subscribe(YAHOO.search.cal.removeSoftSelectedDate, YAHOO.search.cal.checkoutCal, true);
    
    YAHOO.search.cal.checkoutCal.selectEvent.subscribe(YAHOO.search.cal.writeFromCalendarToTextBox, YAHOO.search.cal.checkoutCal, true);
    YAHOO.search.cal.checkoutCal.selectEvent.subscribe(YAHOO.search.cal.updateDayDisplay, YAHOO.search.cal.checkoutCal, true);
    YAHOO.search.cal.checkoutCal.selectEvent.subscribe(YAHOO.search.cal.updateNumberOfNightsDisplayText, YAHOO.search.cal.checkoutCal, true);
    YAHOO.search.cal.checkoutCal.selectEvent.subscribe(YAHOO.search.cal.setHiddens, YAHOO.search.cal.checkoutCal, true);
    

    YAHOO.search.cal.checkinCal.beforeShowEvent.subscribe(YAHOO.search.cal.hideOtherCalendar, YAHOO.search.cal.checkinCal, true);
    YAHOO.search.cal.checkinCal.beforeShowEvent.subscribe(YAHOO.search.cal.addSoftSelectedDate, YAHOO.search.cal.checkinCal, true);
    
    YAHOO.search.cal.checkinCal.changePageEvent.subscribe(YAHOO.search.cal.addSoftSelectedDate, YAHOO.search.cal.checkinCal, true);
    YAHOO.search.cal.checkinCal.hideEvent.subscribe(YAHOO.search.cal.removeSoftSelectedDate, YAHOO.search.cal.checkinCal, true);
    
    YAHOO.search.cal.checkinCal.selectEvent.subscribe(YAHOO.search.cal.writeFromCalendarToTextBox, YAHOO.search.cal.checkinCal, true);
    YAHOO.search.cal.checkinCal.selectEvent.subscribe(YAHOO.search.cal.autoIncrementCheckoutDate, YAHOO.search.cal.checkinCal, true);
    YAHOO.search.cal.checkinCal.selectEvent.subscribe(YAHOO.search.cal.updateDayDisplay, YAHOO.search.cal.checkinCal, true);
    YAHOO.search.cal.checkinCal.selectEvent.subscribe(YAHOO.search.cal.updateNumberOfNightsDisplayText, YAHOO.search.cal.checkinCal, true);
    YAHOO.search.cal.checkinCal.selectEvent.subscribe(YAHOO.search.cal.adjustCheckoutCalRange, YAHOO.search.cal.checkoutCal, true);
    
    YAHOO.search.cal.checkinCal.selectEvent.subscribe(YAHOO.search.cal.setHiddens, YAHOO.search.cal.checkoutCal, true);
    
    /*
     * Highlight current date in calendars
     */
    //YAHOO.search.cal.updateDayDisplayText(YAHOO.search.cal.getCheckinDate(), YAHOO.search.cal.CAL_CONFIG.CHECKIN_DAY_NAME_LABEL);
    //YAHOO.search.cal.updateDayDisplayText(YAHOO.search.cal.getCheckoutDate(), YAHOO.search.cal.CAL_CONFIG.CHECKOUT_DAY_NAME_LABEL);
    //YAHOO.search.cal.updateNumberOfNightsText(YAHOO.search.cal.getCheckinDate(), YAHOO.search.cal.getCheckoutDate());
    YAHOO.search.cal.selectDateAndPage(YAHOO.search.cal.checkoutCal, YAHOO.search.cal.getCheckoutDate());
    YAHOO.search.cal.selectDateAndPage(YAHOO.search.cal.checkinCal, YAHOO.search.cal.getCheckinDate());
};
YAHOO.util.Event.onDOMReady(YAHOO.search.cal.init);

/*
 * Split textfield dates and set into hidden fields
 */
YAHOO.search.cal.setHiddens = function()
{
  var checkin  = jQuery('#' + YAHOO.search.cal.CAL_CONFIG.CHECKIN_TEXT_BOX).val().split('/'),
      checkout = jQuery('#' + YAHOO.search.cal.CAL_CONFIG.CHECKOUT_TEXT_BOX).val().split('/');
  
  jQuery('input[name=arrivalDay]').attr('value', checkin[0]);
  jQuery('input[name=arrivalMonth]').attr('value', checkin[1]);
  jQuery('input[name=arrivalYear]').attr('value', checkin[2]);
  
  jQuery('input[name=departureDay]').attr('value', checkout[0]);
  jQuery('input[name=departureMonth]').attr('value', checkout[1]);
  jQuery('input[name=departureYear]').attr('value', checkout[2]);
     
};

YAHOO.search.cal.validateCheckoutDate = function(type, args, obj) {
    var checkoutString = jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKOUT_TEXT_BOX).val();
    if (chomp(checkoutString) == "") {
        YAHOO.search.cal.calErrorHandler(YAHOO.search.cal.ERROR_CONFIG.ERROR_DEPARTURE_DATE_EMPTY, YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_ID);
        return false;
    } else {
        if (Date.isValid(checkoutString)) {
            var departureDate = Date.parseString(checkoutString);
            jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKOUT_TEXT_BOX).val(departureDate.format(YAHOO.search.cal.CAL_CONFIG.DATE_FORMAT_STRING));
            var arrivalDate = YAHOO.search.cal.getCheckinDate();
            if (arrivalDate == null) {
                return false;
            }
            var maxDepartureDate = YAHOO.search.cal.getCheckinDate().add("d", YAHOO.search.cal.CAL_CONFIG.DEPARTURE_FROM_ARRIVAL_RANGE);
            if (jQuery("#" + YAHOO.search.cal.CAL_CONFIG.REWARDS_CHECKBOX).attr("checked")) {
                maxDepartureDate = YAHOO.search.cal.getCheckinDate().add("d", YAHOO.search.cal.CAL_CONFIG.REWARDS_DEPARTURE_FROM_ARRIVAL_RANGE);
            }
            if (departureDate.isBefore(arrivalDate)) {
                YAHOO.search.cal.calErrorHandler(YAHOO.search.cal.ERROR_CONFIG.ERROR_DEPARTURE_DATE_BEFORE, YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_ID);
                return false;
            } else {
                if (departureDate.isAfter(maxDepartureDate)) {
                    if (jQuery("#" + YAHOO.search.cal.CAL_CONFIG.REWARDS_CHECKBOX).attr("checked")) {
                        YAHOO.search.cal.calErrorHandler(YAHOO.search.cal.ERROR_CONFIG.ERROR_DEPARTURE_HHONORS_RANGE, YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_ID);
                    } else {
                        var nightsAway = calculateNumberOfNights(arrivalDate, departureDate);
                        YAHOO.search.cal.calErrorHandler(YAHOO.search.cal.ERROR_CONFIG.ERROR_DEPARTURE_TOO_FAR, YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_ID, nightsAway);
                    }
                    return false;
                }
            }
            YAHOO.search.cal.clearDepartureErrors();
            YAHOO.search.cal.checkoutCal.select(departureDate);
            YAHOO.search.cal.selectDateAndPage(YAHOO.search.cal.checkoutCal, departureDate);
            return true;
        }
    }
    YAHOO.search.cal.clearDepartureErrors();
    YAHOO.search.cal.calErrorHandler(YAHOO.search.cal.ERROR_CONFIG.ERROR_DEPARTURE_DATE_INVALID, YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_ID);
    return false;
};
YAHOO.search.cal.validateCheckinDate = function(type, args, obj) {
    var checkinString = jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKIN_TEXT_BOX).val();
    if (chomp(checkinString) == "") {
        YAHOO.search.cal.calErrorHandler(YAHOO.search.cal.ERROR_CONFIG.ERROR_ARRIVAL_DATE_EMPTY, YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_ID);
        return false;
    } else {
        if (Date.isValid(checkinString)) {
            var arrivalDate = Date.parseString(checkinString);
            jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKIN_TEXT_BOX).val(arrivalDate.format(YAHOO.search.cal.CAL_CONFIG.DATE_FORMAT_STRING));
            var today = new Date().clearTime();
            var maxArrivalDate = new Date().add("d", YAHOO.search.cal.CAL_CONFIG.ARRIVAL_FROM_TODAY_RANGE).clearTime();
            if (arrivalDate.isBefore(today)) {
                YAHOO.search.cal.calErrorHandler(YAHOO.search.cal.ERROR_CONFIG.ERROR_ARRIVAL_DATE_EARLIER, YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_ID);
                return false;
            } else {
                if (arrivalDate.isAfter(maxArrivalDate)) {
                    YAHOO.search.cal.calErrorHandler(YAHOO.search.cal.ERROR_CONFIG.ERROR_ARRIVAL_DATE_TOO_FAR, YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_ID);
                    return false;
                }
            }
            YAHOO.search.cal.clearArrivalErrors();
            YAHOO.search.cal.checkinCal.select(arrivalDate);
            YAHOO.search.cal.selectDateAndPage(YAHOO.search.cal.checkinCal, arrivalDate);
            return true;
        }
    }
    YAHOO.search.cal.clearArrivalErrors();
    YAHOO.search.cal.calErrorHandler(YAHOO.search.cal.ERROR_CONFIG.ERROR_ARRIVAL_DATE_INVALID, YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_ID);
    return false;
};
YAHOO.search.cal.updateDayDisplay = function(type, args, obj) {
    var jsDate = null;
    var labelField = null;
    if (obj.id == YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_ID) {
        jsDate = YAHOO.search.cal.getCheckinDate();
        labelField = YAHOO.search.cal.CAL_CONFIG.CHECKIN_DAY_NAME_LABEL;
    } else {
        if (obj.id == YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_ID) {
            jsDate = YAHOO.search.cal.getCheckoutDate();
            labelField = YAHOO.search.cal.CAL_CONFIG.CHECKOUT_DAY_NAME_LABEL;
        }
    }
    return YAHOO.search.cal.updateDayDisplayText(jsDate, labelField);
};
YAHOO.search.cal.updateNumberOfNightsDisplayText = function(type, args, obj) {
    return YAHOO.search.cal.updateNumberOfNightsText(YAHOO.search.cal.getCheckinDate(), YAHOO.search.cal.getCheckoutDate());
};
YAHOO.search.cal.hideOtherCalendar = function(type, args, obj) {
    if (obj.id == YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_ID) {
        YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_OPEN = true;
        YAHOO.search.cal.checkoutCal.hide();
    } else {
        if (obj.id == YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_ID) {
            YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_OPEN = true;
            YAHOO.search.cal.checkinCal.hide();
        }
    }
};
/*
 * Deselect a date in the calendar
 */
YAHOO.search.cal.removeSoftSelectedDate = function(type, args, obj) {
    var calContainer = null;
    if (obj.id == YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_ID) {
        calContainer = jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_CONTAINER);
    } else {
        if (obj.id == YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_ID) {
            calContainer = jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_CONTAINER);
        }
    }
    var h = calContainer.find("." + YAHOO.search.cal.CAL_CONFIG.SOFT_SELECT_CLASS);
    h.removeClass(YAHOO.search.cal.CAL_CONFIG.SOFT_SELECT_CLASS);
    return true;
};
/*
 * Select a date in the calendar
 */
YAHOO.search.cal.addSoftSelectedDate = function(type, args, obj) {
    var jsDate = null;
    if (obj.id == YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_ID) {
        jsDate = YAHOO.search.cal.getCheckoutDate();
    } else {
        if (obj.id == YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_ID) {
            jsDate = YAHOO.search.cal.getCheckinDate();
        }
    }
    if (jsDate == null) {
        return true;
    }
    var year = jsDate.format("yyyy");
    var month = jsDate.format("M");
    var day = jsDate.format("d");
    var dateSelectorString = ".y" + year + " .m" + month + " .d" + day;
    jQuery(dateSelectorString).addClass(YAHOO.search.cal.CAL_CONFIG.SOFT_SELECT_CLASS);
    return true;
};
YAHOO.search.cal.autoIncrementCheckoutDate = function(type, args, obj) {
    var arrivalDate = YAHOO.search.cal.getCheckinDate();
    var departureDate = YAHOO.search.cal.getCheckoutDate();
    if (arrivalDate == null || departureDate == null) {
        return false;
    }
    if (arrivalDate.isAfter(departureDate)) {
        var newDepartureDate = YAHOO.search.cal.getCheckinDate().add("d", 1);
        jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKOUT_TEXT_BOX).val(newDepartureDate.format(YAHOO.search.cal.CAL_CONFIG.DATE_FORMAT_STRING));
        YAHOO.search.cal.selectDateAndPage(YAHOO.search.cal.checkoutCal, newDepartureDate);
        YAHOO.search.cal.updateDayDisplayText(newDepartureDate, YAHOO.search.cal.CAL_CONFIG.CHECKOUT_DAY_NAME_LABEL);
    }
    return true;
};
YAHOO.search.cal.adjustCheckoutCalRange = function(type, args, obj) {
    var arrivalDate = YAHOO.search.cal.getCheckinDate();
    var departureDate = YAHOO.search.cal.getCheckoutDate();
    if (arrivalDate == null) {
        return false;
    }
    obj.cfg.setProperty("MINDATE", arrivalDate);
    var maxDepartureDate = YAHOO.search.cal.getCheckinDate().add("d", YAHOO.search.cal.CAL_CONFIG.DEPARTURE_FROM_ARRIVAL_RANGE);
    if (jQuery("#" + YAHOO.search.cal.CAL_CONFIG.REWARDS_CHECKBOX).attr("checked")) {
        maxDepartureDate = YAHOO.search.cal.getCheckinDate().add("d", YAHOO.search.cal.CAL_CONFIG.REWARDS_DEPARTURE_FROM_ARRIVAL_RANGE);
    }
    if (departureDate.isAfter(maxDepartureDate)) {
        departureDate = maxDepartureDate;
        obj.select(maxDepartureDate);
    }
    obj.cfg.setProperty("MAXDATE", maxDepartureDate);
    obj.cfg.setProperty("PAGEDATE", departureDate.format(YAHOO.search.cal.CAL_CONFIG.YUI_PAGE_DATE_FORMAT_STRING));
    obj.render();
    return true;
};
YAHOO.search.cal.writeFromCalendarToTextBox = function(type, args, obj) {
    var dates = args[0];
    var date = dates[0];
    var jsDate = new Date();
    jsDate.setFullYear(date[0], date[1] - 1, date[2]);
    var dateField = null;
    if (obj.id == YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_ID) {
        YAHOO.search.cal.clearArrivalErrors();
        dateField = jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKIN_TEXT_BOX);
    } else {
        if (obj.id == YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_ID) {
            YAHOO.search.cal.clearDepartureErrors();
            dateField = jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKOUT_TEXT_BOX);
        }
    }
    dateField.val(jsDate.format(YAHOO.search.cal.CAL_CONFIG.DATE_FORMAT_STRING));
    obj.hide();
};
/*
 * Get dates from text boxes, setting a default if there is none
 */
YAHOO.search.cal.getCheckinDate = function() {
    var box = jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKIN_TEXT_BOX),
        checkinDateString = box.val(),
        today = new Date();
        
    if (!Date.isValid(checkinDateString, YAHOO.search.cal.CAL_CONFIG.DATE_FORMAT_STRING)) {
        checkinDateString = today.format(YAHOO.search.cal.CAL_CONFIG.DATE_FORMAT_STRING);
        box.val(checkinDateString);
    }
    
    return Date.parseString(checkinDateString, YAHOO.search.cal.CAL_CONFIG.DATE_FORMAT_STRING).clearTime();
};
YAHOO.search.cal.getCheckoutDate = function() {
    var box = jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKOUT_TEXT_BOX), 
        checkoutDateString = box.val(),
        today = new Date();
        
    if (!Date.isValid(checkoutDateString, YAHOO.search.cal.CAL_CONFIG.DATE_FORMAT_STRING)) {
        checkoutDateString = today.add("d", 1).format(YAHOO.search.cal.CAL_CONFIG.DATE_FORMAT_STRING);
        box.val(checkoutDateString);
    }
    return Date.parseString(checkoutDateString, YAHOO.search.cal.CAL_CONFIG.DATE_FORMAT_STRING).clearTime();
};
YAHOO.search.cal.updateNumberOfNightsText = function(arrivalDate, departureDate) {
    if (arrivalDate == null || departureDate == null) {
        jQuery("#" + YAHOO.search.cal.CAL_CONFIG.NUMBER_OF_NIGHTS_P).html("");
        return false;
    }
    var nightDifference = calculateNumberOfNights(arrivalDate, departureDate);
    if (nightDifference < 0) {
        return false;
    }
    var nightStayTextInput = jQuery("#" + YAHOO.search.cal.CAL_CONFIG.NIGHT_STAY_TEXT);
    var zeroNightStayTextInput = jQuery("#" + YAHOO.search.cal.CAL_CONFIG.ZERO_NIGHT_STAY_TEXT);
    if (nightStayTextInput.length < 0 || zeroNightStayTextInput.length < 0) {
        return;
    }
    if (nightDifference > 0) {
        jQuery("#" + YAHOO.search.cal.CAL_CONFIG.NUMBER_OF_NIGHTS_P).html("<span id='" + YAHOO.search.cal.CAL_CONFIG.NUMBER_OF_NIGHTS_SPAN + "'></span> " + nightStayTextInput.val());
        jQuery("#" + YAHOO.search.cal.CAL_CONFIG.NUMBER_OF_NIGHTS_SPAN).html(nightDifference);
    } else {
        if (nightDifference == 0) {
            jQuery("#" + YAHOO.search.cal.CAL_CONFIG.NUMBER_OF_NIGHTS_P).html(zeroNightStayTextInput.val());
        } else {
            jQuery("#" + YAHOO.search.cal.CAL_CONFIG.NUMBER_OF_NIGHTS_P).html("");
        }
    }
    return true;
};
YAHOO.search.cal.updateDayDisplayText = function(jsDate, labelFieldId) {
    if (jsDate == null) {
        jQuery("#" + labelFieldId).html("");
        return false;
    }
    jQuery("#" + labelFieldId).html(jsDate.getDayName());
    return true;
};
YAHOO.search.cal.selectDateAndPage = function(yuiCal, jsDate) {
    yuiCal.cfg.setProperty("PAGEDATE", jsDate.format(YAHOO.search.cal.CAL_CONFIG.YUI_PAGE_DATE_FORMAT_STRING));
    yuiCal.cfg.setProperty("SELECTED", jsDate.format(YAHOO.search.cal.CAL_CONFIG.YUI_DATE_FORMAT_STRING));
    yuiCal.render();
};
YAHOO.search.cal.clearArrivalErrors = function() {
    jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKIN_DAY_NAME_LABEL).show();
    jQuery("#" + YAHOO.search.cal.ERROR_CONFIG.ERROR_LIST_ID).children("ul").children("li." + YAHOO.search.cal.ERROR_CONFIG.CHECKIN_ERROR_CLASS).hide();
    jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKIN_FIELDSET).removeClass("inline error");
    YAHOO.search.cal.checkAndHandleNoErrors();
};
YAHOO.search.cal.clearDepartureErrors = function() {
    jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKOUT_DAY_NAME_LABEL).show();
    jQuery("#" + YAHOO.search.cal.ERROR_CONFIG.ERROR_LIST_ID).children("ul").children("li." + YAHOO.search.cal.ERROR_CONFIG.CHECKOUT_ERROR_CLASS).hide();
    jQuery("#" + YAHOO.search.cal.CAL_CONFIG.CHECKOUT_FIELDSET).removeClass("inline error");
    YAHOO.search.cal.checkAndHandleNoErrors();
};
YAHOO.search.cal.checkAndHandleNoErrors = function() {
    var datesFs = jQuery("#" + YAHOO.search.cal.CAL_CONFIG.DATES_FIELDSET);
    var errorList = jQuery("#" + YAHOO.search.cal.ERROR_CONFIG.ERROR_LIST_ID);
    var numNightsP = jQuery("#" + YAHOO.search.cal.CAL_CONFIG.NUMBER_OF_NIGHTS_P);
    if (datesFs.find(".inline.error").length <= 0) {
        errorList.hide();
        numNightsP.show();
    }
};
YAHOO.search.cal.calErrorHandler = function(errorName, calId, param) {};
YAHOO.search.cal.adjustDepartureCalRange = function(checkbox) {
    if (YAHOO.search.cal.getCheckinDate() == null) {
        return;
    }
    var departureDate = YAHOO.search.cal.getCheckoutDate();
    var maxDepartureDate = YAHOO.search.cal.getCheckinDate().add("d", YAHOO.search.cal.CAL_CONFIG.DEPARTURE_FROM_ARRIVAL_RANGE);
    if (jQuery(checkbox).attr("checked")) {
        maxDepartureDate = YAHOO.search.cal.getCheckinDate().add("d", YAHOO.search.cal.CAL_CONFIG.REWARDS_DEPARTURE_FROM_ARRIVAL_RANGE);
    }
    if (departureDate.isAfter(maxDepartureDate)) {
        departureDate = YAHOO.search.cal.getCheckinDate().add("d", 1);
        YAHOO.search.cal.checkoutCal.cfg.setProperty("SELECTED", departureDate.format(YAHOO.search.cal.CAL_CONFIG.YUI_DATE_FORMAT_STRING));
    }
    YAHOO.search.cal.updateNumberOfNightsText(YAHOO.search.cal.getCheckinDate(), departureDate);
    YAHOO.search.cal.checkoutCal.cfg.setProperty("MAXDATE", maxDepartureDate);
    YAHOO.search.cal.checkoutCal.render();
};
jQuery(document).ready(function() {
    jQuery(document).click(function() {
        if (!YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_OPEN && YAHOO.search.cal.checkinCal != null) {
            YAHOO.search.cal.checkinCal.hide();
        }
        if (!YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_OPEN && YAHOO.search.cal.checkoutCal != null) {
            YAHOO.search.cal.checkoutCal.hide();
        }
        YAHOO.search.cal.CAL_CONFIG.CHECKIN_CAL_OPEN = false;
        YAHOO.search.cal.CAL_CONFIG.CHECKOUT_CAL_OPEN = false;
    });
});
/*############ End common/js/plug/yuiCal_search.js ############*/

/*############ Begin common/js/plug/global.js ############*/
function addLoadEvent(func) {
    jQuery(document).ready(function($) {
        func();
    });
}
function getId(strId) {
    return document.getElementById(strId);
}
function getElementsByClassName(className, tag, elm) {
    var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");
    var tag = tag || "*";
    var elm = elm || document;
    var elements = (tag == "*" && elm.all) ? elm.all: elm.getElementsByTagName(tag);
    var returnElements = [];
    var current;
    var length = elements.length;
    for (var i = 0; i < length; i++) {
        current = elements[i];
        if (testClass.test(current.className)) {
            returnElements.push(current);
        }
    }
    return returnElements;
}
function addClassName(oElm, strClassName) {
    var strCurrentClass = oElm.className;
    if (!new RegExp(strClassName, "i").test(strCurrentClass)) {
        oElm.className = strCurrentClass + ((strCurrentClass.length > 0) ? " ": "") + strClassName;
    }
}
function removeClassName(oElm, strClassName) {
    var oClassToRemove = new RegExp((strClassName + "s?"), "i");
    oElm.className = oElm.className.replace(oClassToRemove, "").replace(/^\s?|\s?$/g, "");
}
function ce(tag, name) {
    if (name && window.ActiveXObject) {
        element = document.createElement("<" + tag + ' name="' + name + '">');
    } else {
        element = document.createElement(tag);
        element.setAttribute("name", name);
    }
    return element;
}
function popupFamilyPolicy(winURL) {
    window.open(winURL, "popupfamilypolicy", "resizable=1,location=0,toolbar=0,scrollbars=1,width=300,height=400");
}
function popupChargeDetails(winURL) {
    window.open(winURL, "popupchargedetails", "resizable=1,location=0,toolbar=0,scrollbars=1,width=400,height=400");
}
function popupRoomDetails(winURL) {
    window.open(winURL, "popupRoomDetails", "resizable=1,location=0,toolbar=0,scrollbars=1,width=400,height=400");
}
function popupTaxAndRateDetails(winURL) {
    window.open(winURL, "popupTaxAndRateDetails", "resizable=1,location=0,toolbar=0,scrollbars=1,width=400,height=400");
}
function popupPlanDetails(winURL) {
    window.open(winURL, "popupPlanDetails", "resizable=1,location=0,toolbar=0,scrollbars=1,width=400,height=400");
}
function popupRoomPlanDetails(winURL) {
    window.open(winURL, "popupRoomPlanDetails", "resizable=1,location=0,toolbar=0,scrollbars=1,width=650,height=400");
}
function popupPurchasePoints(winURL) {
    window.open(winURL, "popupPurchasePoints", "resizable=1,location=0,toolbar=0,scrollbars=1,width=730,height=500");
}
function prepareLinks() {
    if (!document.getElementsByTagName) {
        return false;
    }
    var lnks = document.getElementsByTagName("a");
    for (var i = 0; i < lnks.length; i++) {
        if (lnks[i].className == "popup") {
            addClassName(lnks[i], "pops");
            if (!lnks[i].onclick) {
                lnks[i].onclick = function() {
                    openPopup(this.getAttribute("href"));
                    return false;
                };
            }
        }
        if (lnks[i].className == "famPolicyLink") {
            addClassName(lnks[i], "pops");
            lnks[i].onclick = function(event) {
                popupFamilyPolicy(this.getAttribute("href"));
                return false;
            };
        }
        if (lnks[i].className == "popupChargeDetails") {
            addClassName(lnks[i], "pops");
            lnks[i].onclick = function() {
                popupChargeDetails(this.getAttribute("href"));
                return false;
            };
        }
        if (lnks[i].className == "popupRoomDetails") {
            addClassName(lnks[i], "pops");
            lnks[i].onclick = function() {
                popupRoomDetails(this.getAttribute("href"));
                return false;
            };
        }
        if (lnks[i].className == "popupTaxAndRateDetails") {
            addClassName(lnks[i], "pops");
            lnks[i].onclick = function() {
                popupTaxAndRateDetails(this.getAttribute("href"));
                return false;
            };
        }
        if (lnks[i].className == "popupPlanDetails") {
            addClassName(lnks[i], "pops");
            lnks[i].onclick = function() {
                popupPlanDetails(this.getAttribute("href"));
                return false;
            };
        }
        if (lnks[i].className == "popupRoomPlanDetails") {
            addClassName(lnks[i], "pops");
            lnks[i].onclick = function() {
                popupRoomPlanDetails(this.getAttribute("href"));
                return false;
            };
        }
        if (lnks[i].className == "popupPurchasePoints") {
            addClassName(lnks[i], "pops");
            lnks[i].onclick = function() {
                popupPurchasePoints(this.getAttribute("href"));
                return false;
            };
        }
        if (lnks[i].className == "view3DvirtualTour") {
            lnks[i].onclick = function() {
                popupRoomDetails(this.getAttribute("href"));
                return false;
            };
        }
    }
}
addLoadEvent(prepareLinks);
function globalshow(el, blockorinline) {
    var el = getId(el);
    el.style.display = blockorinline;
}
function globalhide(el) {
    var el = getId(el);
    el.style.display = "none";
}
jQuery(document).ready(function() {});
function limitText(textArea, limitCountSpan, limitNum) {
    var limitField = jQuery(textArea);
    var limitCount = jQuery("#" + limitCountSpan);
    if (limitField.length == 0) {
        return;
    }
    if (limitField.val().length > limitNum) {
        limitField.val(limitField.val().substring(0, limitNum));
    }
    limitCount.html(Number(limitNum) - Number(limitField.val().length));
    if (limitNum - limitField.val().length == 0) {
        limitCount.html("0");
    }
}
function calculateNumberOfNights(startDate, endDate) {
    if (startDate != null && endDate != null) {
        var non = 0;
        if (endDate.isBefore(startDate)) {
            var swapDate = startDate;
            startDate = endDate;
            endDate = swapDate;
        }
        if (startDate.isBefore(endDate)) {
            while (startDate.isBefore(endDate) && non < 2000) {
                non++;
                startDate = startDate.add("d", 1);
            }
        }
        return non;
    }
    return null;
}
function chomp(text) {
    return text.replace(/(\n|\r)+$/, "");
}
/*############ End common/js/plug/global.js ############*/
/*############ Begin common/js/plug/hotel_search_widget.js ############*/
jQuery(document).ready(function() {
    var codePromo = jQuery("#specialCodePromotion");
    var codeGroup = jQuery("#specialCodeGroup");
    var codeCorp = jQuery("#specialCodeCorporate");
    var codeTravel = jQuery("#specialCodeTravelAgent");
    if (codePromo.length && codeGroup.length && codeCorp.length && codeTravel.length) {
        if (codePromo.val().length == 0 && codeGroup.val().length == 0 && codeCorp.val().length == 0 && codeTravel.val().length == 0) {
            jQuery("#searchWidgetOptionalFields").hide();
        }
    }
    jQuery("#fsRoomsHHonors").hide();
    jQuery("#fsFlexibleNumberOfNights").hide();
    showAppropriateNumberOfRoomRows(jQuery("#roomsNumber"));
    var roomsInd = jQuery("#roomsNumber").val();
    showAppropriateNumberOfRoomRows(roomsInd);
    rewardSearchResetToOneRoomAndOtherToggles(jQuery("#checkRewardSearch")[0]);
});
function showAppropriateNumberOfRoomRows(ind) {
    var ind = jQuery("#roomsNumber").val();
    if (ind < 5) {
        jQuery(".roomNumberLabel,.colNumberOfChildren,.colNumberOfAdults,#fsSpecialAccounts,.searchToggler").show();
        jQuery("#tableRoomQuantity tbody tr").slice(0, ind).css("display", "");
        jQuery("#tableRoomQuantity tbody tr").slice(ind).css("display", "none");
        jQuery(".roomNumberLabel").show();
        if (ind == 1) {
            jQuery(".roomNumberLabel").hide();
        }
    }
    if (ind >= 5) {
        jQuery("#tableRoomQuantity tbody tr").slice(1).css("display", "none");
        jQuery(".roomNumberLabel,.colNumberOfChildren,.colNumberOfAdults,#fsSpecialAccounts,.searchToggler").hide();
    }
}
function blurCheckForLength() {
    var fsCheckRememberMe = jQuery("#fsCheckRememberMe");
    var codeCorporate = jQuery("#specialCodeCorporate");
    var codeTravelAgent = jQuery("#specialCodeTravelAgent");
    var hasFocus = false;
    if (hasFocus || (codeCorporate.val().length != 0) || (codeTravelAgent.val().length != 0)) {
        fsCheckRememberMe.css("visibility", "visible");
    } else {
        fsCheckRememberMe.css("visibility", "hidden");
        jQuery("#checkRememberSpecialCodes").removeAttr("checked");
    }
}
function rewardSearchResetToOneRoomAndOtherToggles(checkbox) {
    if (jQuery(checkbox).attr("checked")) {
        jQuery("#roomsNumber").val(1);
        showAppropriateNumberOfRoomRows();
        jQuery("#fsSpecialCodeCorporate,#fsSpecialCodeTravelAgent,.colNumberOfRooms").hide();
        jQuery("#fsRoomsHHonors").show();
    } else {
        jQuery("#fsSpecialCodeCorporate,#fsSpecialCodeTravelAgent,.colNumberOfRooms").show();
        jQuery("#fsRoomsHHonors").hide();
    }
}
function toggleFieldsBasedOnFixedOrFlexibleDates(checkbox) {
    if (jQuery(checkbox).attr("checked")) {
        jQuery("#fsCheckout,p#numberOfNights").hide();
        jQuery("#fsFlexibleNumberOfNights").show();
        jQuery('label[for="checkin"]').text("Arriving Around");
    } else {
        jQuery("#fsCheckout,p#numberOfNights").show();
        jQuery("#fsFlexibleNumberOfNights").hide();
        jQuery('label[for="checkin"]').text("Arrival");
    }
}
function toggleOptionalFields(link, txt1, txt2) {
    var $jlink = jQuery(link);
    href = $jlink.attr("href");
    if ($jlink.hasClass("collapsed")) {
        jQuery(href).show();
        $jlink.addClass("expanded").removeClass("collapsed");
        $jlink.text(txt2);
    } else {
        jQuery(href).hide();
        $jlink.removeClass("expanded").addClass("collapsed");
        $jlink.text(txt1);
    }
}
/**/
function submitHotelSearchWidgetForm() {
    if (!jQuery("#searchWidgetOptionalFields").is(":visible")) {
        jQuery("#specialCodePromotion,#specialCodeGroup,#specialCodeCorporate,#specialCodeTravelAgent").val("");
    }	
    jQuery("#bswWaiting").removeClass("hide2");	
    //var ie7ImgSrc = jQuery("#bswWaiting img").attr("src");	
    jQuery(".hotelSearchWidgetForm").submit();
    //jQuery("#bswWaiting img").attr("src", ie7ImgSrc);
}
function submitEventBSWForm() {
    jQuery("#bswWaiting").show().css("visibility", "visible");
}
/*############ End common/js/plug/hotel_search_widget.js ############*/
/*############ Begin common/js/plug/facility_search_widget.js ############*/
jQuery(document).ready(function() {
    jQuery("span.whatsThisHint").hide();
    jQuery(".offerPkg:last").css({
        border: "none",
        "padding-bottom": "16px"
    });
    jQuery("#comparingHotels").hide();
    jQuery("#participatingHotelsH2").toggle(function() {
        jQuery(this).addClass("collapsedh2");
        jQuery("#participatingHotels").hide();
    },
    function() {
        jQuery(this).removeClass("collapsedh2");
        jQuery("#participatingHotels").show();
    });
    jQuery("#comparingHotelsH2").toggle(function() {
        jQuery(this).addClass("expandedh2");
        jQuery("#comparingHotels").show();
    },
    function() {
        jQuery(this).removeClass("expandedh2");
        jQuery("#comparingHotels").hide();
    });
    var locSearch = jQuery("#locsearch");
    locSearch.each(function() {
        if (this.value == "") {
            this.value = this.title;
        }
    });
    locSearch.focus(function() {
        if (this.value == this.title) {
            this.value = "";
        }
    });
    locSearch.blur(function() {
        if (this.value == "") {
            this.value = this.title;
        }
    });
    jQuery(document).keydown(function(e) {
        if (e.which == 27) {
            locSearch.blur();
        }
    });
    jQuery(".hintContainer").hover(function() {
        jQuery(this).children("span.whatsThisHint").show();
    },
    function() {
        jQuery(this).children("span.whatsThisHint").hide();
    });
    jQuery("#rfp_accomm_reqs1").click(function() {
        jQuery("#rfp_checkin_toggle").show();
    });
    jQuery("#rfp_accomm_reqs2").click(function() {
        jQuery("#rfp_checkin_toggle").hide();
    });
    jQuery("#rfp_function_room1").click(function() {
        jQuery("#rfp_function_toggle").show();
    });
    jQuery("#rfp_function_room2").click(function() {
        jQuery("#rfp_function_toggle").hide();
    });
    jQuery(".brandfilter .selectAll").click(function() {
        jQuery('.brandfilter input[type="checkbox"]').attr("checked", "checked");
    });
    jQuery(".brandfilter .deselectAll").click(function() {
        jQuery('.brandfilter input[type="checkbox"]').attr("checked", "");
    });
    jQuery("#isAddGuestRoomOpen").val(false);
    jQuery("#isAddMeetingRoomOpen").val(false);
	
	/*
	var srchBox = jQuery("#hotelSearchOneBox[type=text]");
    if (jQuery("#isCollapsableWidget").val() == "false" && srchBox.length) {
        srchBox.select();
        srchBox.focus();
    }
*/
    jQuery("#signIn").hide();
});
function toggleCloserLook(link, openStateTxt1, ClosedStateTxt2, openStateTitle, closedStateTitle) {
    var link = jQuery(link);
    if (link.hasClass("collapsed")) {
        link.text(openStateTxt1);
        link.attr("title", openStateTitle);
        link.replaceClass("collapsed", "expanded");
        jQuery(link).parents(".hsresult").find(".closerLook").slideToggle();
    } else {
        link.text(ClosedStateTxt2);
        link.attr("title", closedStateTitle);
        link.replaceClass("expanded", "collapsed");
        jQuery(link).parents(".hsresult").find(".closerLook").slideToggle();
    }
    return false;
}
function toggleMeetingOptionalFields(link, txt1, txt2) {
    var $jlink = jQuery(link);
    href = $jlink.attr("href");
    if ($jlink.hasClass("collapsed")) {
        jQuery(href).show();
        $jlink.addClass("expanded").removeClass("collapsed");
        $jlink.text(txt2);
    } else {
        jQuery(href).hide();
        $jlink.removeClass("expanded").addClass("collapsed");
        $jlink.text(txt1);
    }
    var hiddenFieldToggle;
    if (link.id == "guestRoomLink") {
        hiddenFieldToggle = jQuery("#isAddGuestRoomOpen");
    } else {
        if (link.id == "meetingRoomLink") {
            hiddenFieldToggle = jQuery("#isAddMeetingRoomOpen");
        }
    }
    if (hiddenFieldToggle.val() == "true") {
        hiddenFieldToggle.val("false");
    } else {
        hiddenFieldToggle.val("true");
    }
}
function addClassToThisElement(el, classvalue) {
    jQuery(el).find(".helpHint").css("display", "block");
}
function removeClassFromThisElement(el, classvalue) {
    jQuery(el).find(".helpHint").css("display", "none");
}
/*############ End common/js/plug/facility_search_widget.js ############*/
/*############ Begin common/js/plug/hotel_search_results.js ############*/
jQuery(document).ready(function() {
    var defaultRadius = Math.round(jQuery("#defaultSearchRadius").val());
    installPriceSlider();
    installPointsSlider();
    installRadiusSlider(defaultRadius);
    jQuery("#fsRoomsHHonors").hide();
    if (jQuery("#isErrorOnPage").val() == "true") {
        searchAgainAndShowMeNewFields();
    }
});
function installPointsSlider() {
    var min = jQuery("#pointsSliderValueLow").html();
    var max = jQuery("#pointsSliderValueHigh").html();
    if (min != null) {
        jQuery("#pointsSlider").slider({
            minValue: min,
            maxValue: max,
            stepping: 500,
            slide: function(e, ui) {
                if (ui.handle.id == "pointsHandleLow") {
                    jQuery("#pointsSliderValueLow").text(ui.value);
                }
                if (ui.handle.id == "pointsHandleHigh") {
                    jQuery("#pointsSliderValueHigh").text(ui.value);
                }
            },
            change: function(e, ui) {
                jQuery("#updatingBlockOverlay").show();
                jQuery("#updatingBlock").show();
                var lowValue = jQuery("#pointsSliderValueLow").html();
                var highValue = jQuery("#pointsSliderValueHigh").html();
                changeSearchFilter("pointsRange", "", lowValue, highValue);
            }
        });
    }
}
function installPriceSlider() {
    var min = jQuery("#minimumCost").val();
    var max = jQuery("#maximumCost").val();
    var currencyFormat = jQuery("#currencyFormat").val();
    var lowValue = min;
    var highValue = max;
    jQuery("#priceSlider").slider({
        minValue: min,
        maxValue: max,
        slide: function(e, ui) {
            var fmtValue = CurrencyUtils.formatBySymbol(ui.value, G_LOCALE, currencyFormat);
            if (ui.handle.id == "priceHandleLow") {
                jQuery("#priceSliderValueLow").text(fmtValue);
            }
            if (ui.handle.id == "priceHandleHigh") {
                jQuery("#priceSliderValueHigh").text(fmtValue);
            }
        },
        change: function(e, ui) {
            if (ui.handle.id == "priceHandleLow") {
                lowValue = ui.value;
            }
            if (ui.handle.id == "priceHandleHigh") {
                highValue = ui.value;
            }
            jQuery("#updatingBlockOverlay").show();
            jQuery("#updatingBlock").show();
            changeSearchFilter("priceRange", "", lowValue, highValue);
        }
    });
}
function installRadiusSlider(defaultRadius) {
    jQuery("#radiusSlider").slider({
        minValue: 1,
        maxValue: 15,
        startValue: defaultRadius,
        steps: 15,
        slide: function(e, ui) {
            var radius = figureOutTheRadiusSteps(ui.value);
            jQuery("#radiusSliderValue").text(radius);
        },
        change: function(e, ui) {
            jQuery("#updatingBlockOverlay").show();
            jQuery("#updatingBlock").show();
            var maxDistance = jQuery("#radiusSliderValue").html();
            changeSearchFilter("distanceRange", "", "", maxDistance);
        }
    });
}
function figureOutTheRadiusSteps(step) {
    var distance = 0;
    switch (step) {
    case 1:
        distance = "0.5";
        break;
    case 2:
        distance = "1";
        break;
    case 3:
        distance = "2";
        break;
    case 4:
        distance = "3";
        break;
    case 5:
        distance = "4";
        break;
    case 6:
        distance = "5";
        break;
    case 7:
        distance = "10";
        break;
    case 8:
        distance = "15";
        break;
    case 9:
        distance = "20";
        break;
    case 10:
        distance = "25";
        break;
    case 11:
        distance = "30";
        break;
    case 12:
        distance = "35";
        break;
    case 13:
        distance = "40";
        break;
    case 14:
        distance = "45";
        break;
    case 15:
        distance = "50";
        break;
    }
    return distance;
}
var mapLoaded = false;
function toggleTheMap(link, latitude, longitude, hideMapText, showMapText) {
    var link = jQuery(link);
    href = link.attr("href");
    if (link.hasClass("collapsed")) {
        link.text(hideMapText);
        if (mapLoaded == false) {
            startMap(latitude, longitude);
        }
        link.replaceClass("collapsed", "expanded");
        jQuery(href).show();
        jQuery(".mapMarker1").show();
        jQuery(".mapMarker").show();
        jQuery(".hsresult h2").addClass("makeRoomForMapMarker");
        mapLoaded = true;
    } else {
        link.text(showMapText);
        link.replaceClass("expanded", "collapsed");
        jQuery(href).hide();
        jQuery(".mapMarker1").hide();
        jQuery(".mapMarker").hide();
        jQuery(".hsresult h2").removeClass("makeRoomForMapMarker");
    }
    return false;
}
function submitFormUpdateSearchResults() {
    jQuery("#formUpdateNumberOfResults").submit();
    return;
}
function searchAgainAndShowMeNewFields() {
    jQuery("#searchResultsSearchAgain").show();
    jQuery("#searchSummary").hide();
    return false;
}
function cancelRequestToSearchAgain() {
    jQuery("#searchResultsSearchAgain").hide();
    jQuery("#searchSummary").show();
    return false;
}
function toggleCloserLook(link) {
    jQuery(link).parents(".hsresult").find(".closerLook").slideToggle();
    return false;
}
function toggleCloserLookFlash(link, searchResultXml) {
    var flashHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="376" height="325" title="Search Results - Closer look"> 		<param name="movie" value="' + G_CONTEXT_PATH + '/media/flash/WS_1_SearchResults.swf" /> 		<param name="quality" value="high" /> 		<param name="FlashVars" value="XMLStrm=' + searchResultXml + '" /> 		<embed wmode="transparent" 			src="' + G_CONTEXT_PATH + '/media/flash/WS_1_SearchResults.swf" 			quality="high" 			pluginspage="http://www.macromedia.com/go/getflashplayer" 			FlashVars="XMLStrm=' + searchResultXml + '" 			type="application/x-shockwave-flash" 			width="376" 			height="325"> 		</embed> 	</object>';
    jQuery(link).parent().parent().siblings(".closerLook").find("p.closerLookFlashContainer").empty();
    jQuery(link).parent().parent().siblings(".closerLook").find("p.closerLookFlashContainer").append(flashHTML);
}
function redirectToViewPageAction(link, pageNum) {
    var fakeLink = jQuery("#viewPageActionAnchor").attr("href");
    fakeLink = fakeLink.replace("xxxxxxxx", pageNum);
    link.href = fakeLink;
    return true;
}
function redirectToHotelLink(link, ctyhocn) {
    var fakeLink = jQuery("#linkToHotelPageAnchor").attr("href");
    fakeLink = fakeLink.replace("xxxxxxxx", ctyhocn);
    link.href = fakeLink;
    return false;
}
function redirectToAddToCompareAction(link, ctyhocn, distance, bucketFullMessage, bucketSize, maxBucketSize) {
    if (bucketSize >= maxBucketSize) {
        alert(bucketFullMessage);
        return false;
    }
    var fakeLink = jQuery("#addToBucketActionAnchor").attr("href");
    fakeLink = fakeLink.replace("xxxxxxxx", ctyhocn);
    fakeLink = fakeLink.replace("yyyyyyyy", distance);
    link.href = fakeLink;
    return true;
}
function redirectToRemoveFromCompareAction(link, ctyhocn, distance) {
    var fakeLink = jQuery("#removeFromBucketActionAnchor").attr("href");
    fakeLink = fakeLink.replace("xxxxxxxx", ctyhocn);
    fakeLink = fakeLink.replace("yyyyyyyy", distance);
    link.href = fakeLink;
    return true;
}
function redirectToEnquireAction(link, bucketFullMessage, bucketSize, ctyhocn, option) {
    var fakeLink = jQuery("#maintainRfpBucketBucketActionAnchor").attr("href");
    fakeLink = fakeLink.replace("xxxxxxxx", ctyhocn);
    fakeLink = fakeLink.replace("yyyyyyyy", option);
    link.href = fakeLink;
    if (bucketSize >= 4 && option == "add") {
        alert(bucketFullMessage);
        return false;
    } else {
        return true;
    }
}
/*############ End common/js/plug/hotel_search_results.js ############*/
/*############ Begin common/js/plug/sayt.js ############*/
(function($) {
    $.fn.sayt = function(opts) {
        var opts = $.extend({},
        $.fn.sayt.defaults, opts);
        return this.each(function() {
            var $this = $(this);
            $this.attr("autocomplete", "off");
            $this.autocomplete({
                getList: function(input) {
                    var q = $this.val().toLowerCase();
                    q = jQuery.trim(q);
                    if (q.length < opts.min || q.length > opts.max) {
                        $("body").trigger("off.autocomplete");
                        return;
                    }
                    var p = $.extend({
                        q: q
                    },
                    opts.params);
                    if (p.clazz) {
                        p["class"] = opts.params.clazz;
                        delete p.clazz;
                    }
/*
                    jQuery.getJSON(opts.url, p,
                    function(data) {
                        input.trigger("updateList", [data]);
                    });
*/
                },
                match: function(typed) {
                    return true;
                },
                insertText: function(suggestionsResponse) {
                    return suggestionsResponse.Display;
                },
                template: function(suggestionsResponse) {
                    return "<li class='" + suggestionsResponse.Class + "'>" + suggestionsResponse.Display + "</li>";
                }
            });
        });
    };
    $.fn.sayt.defaults = {
        url: G_CONTEXT_PATH + "/sayt/",
        min: 2,
        max: 12,
        params: {}
    };
})(jQuery);
jQuery(document).ready(function($) {
								
    $("#locsearch").sayt({
        url: G_SAYT,
        params: {
            locale: G_LOCALE
        }
    });
    $("#hotelSearchOneBox").sayt({
        url: G_SAYT,
        params: {
            locale: G_LOCALE
        }
    });
    $("#hotelSearchOneBoxCity").sayt({
        url: G_SAYT,
        params: {
            clazz: "c",
            locale: G_LOCALE
        }
    });
    $("#hotelSearchOneBoxAirport").sayt({
        url: G_SAYT,
        params: {
            clazz: "a",
            locale: G_LOCALE
        }
    });
});
/*############ End common/js/plug/sayt.js ############*/

/*############ Begin hiway/en_GB/js/plug/onsite.js ############*/

// MC - changed this path for development
var onSurveyImage = "/HiWayWeb/framework/skins/hiway/en_GB/i/popup0.swf";
//var onImagesPath = onSurveyImage;
var onImagesPath = "bookingEngine/images/i";
var onSecureImagePath = onSurveyImage;
var onErrorPath = error404page;
var onCookieDomain = G_DOMAIN;
var onCookieName = "OnSiteHilton";
var onBulletPath = "http://onsite.hilton-research.com/images/hilton_uks.gif";
var onCookiePath = "/";
var onCookieDuration = null;
var onPopFreq = tempSurveyFreq;
var onPopDelay = 2000;
var onPagePop = true;
var onRun = true;
var onFlashParam = '<param name="play" value="true" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="allowScriptAccess" value="always" />';
function onClientWidth() {
    return typeof(window.innerWidth) == "number" ? window.innerWidth: dD.documentElement && dD.documentElement.clientWidth ? dD.documentElement.clientWidth: dD.body && dD.body.clientWidth ? dD.body.clientWidth: 0;
}
function onClientHeight() {
    return typeof(window.innerWidth) == "number" ? window.innerHeight: dD.documentElement && dD.documentElement.clientHeight ? dD.documentElement.clientHeight: dD.body && dD.body.clientHeight ? dD.body.clientHeight: 0;
}
function onScrollX() {
    return typeof(window.pageXOffset) == "number" ? window.pageXOffset: dD.body && dD.body.scrollLeft ? dD.body.scrollLeft: dD.documentElement && dD.documentElement.scrollLeft ? dD.documentElement.scrollLeft: 0;
}
function onScrollY() {
    return typeof(window.pageYOffset) == "number" ? window.pageYOffset: dD.body && dD.body.scrollTop ? dD.body.scrollTop: dD.documentElement && dD.documentElement.scrollTop ? dD.documentElement.scrollTop: 0;
}
function ONS_getObj(n) {
	
    return dD.getElementById ? dD.getElementById(n) : dD.all ? dD.all[n] : dD.layers[n];
}
function ONS_chkIndex(v1) {
    var onsi = v1.split("/");
    if ((onsi[3] == "") || (typeof(onsi[4]) == "undefined" && onsi[3].indexOf("index") != -1)) {
        return true;
    }
    return false;
}
function ONS_getRandom() {
    return Math.random();
}
function ONS_getSiteID(v1) {
    var siteID = ONS_getCookie("SiteID");
    if (siteID == null) {
        var t = new Date();
        siteID = Math.floor(Math.random() * 10000000000000) + "" + t.getTime();
        ONS_setCookie("SiteID", siteID, onCookieDuration, 24);
    }
    return siteID;
}
function ONS_getURL(v1, v2) {
    if ((v1 == null) || (v1 == "")) {
        return "NONE";
    }
    v1 = v1.toString().toLowerCase();
    return v1.substring(0, (pos = v1.indexOf(v2)) > 0 ? pos: v1.length);
}
function ONS_getParameter(pl, pStr) {
    if ((pl == null) || (pl == "")) {
        return false;
    }
    pl = pl.toString().toLowerCase();
    pStr = pStr + "=";
    var bpos = pl.indexOf(pStr);
    if (bpos != -1) {
        bpos += pStr.length;
        var epos = pl.indexOf("&", bpos);
        if (epos == -1) {
            epos = pl.length;
        }
        return unescape(pl.substring(bpos, epos));
    }
    return "";
}
function ONS_getCookie(n) {
    var name = n + "=",
    ca = dD.cookie.split(";");
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == " ") {
            c = c.substring(1, c.length);
        }
        if (c.indexOf(name) == 0) {
            return c.substring(name.length, c.length);
        }
    }
    return null;
}
function ONS_setCookie(n, v, d, h) {
    var t = new Date(),
    g = v.toString().toLowerCase();
    t.setTime(t.getTime() + (d * h * 60 * 60 * 1000));
    var exp = d ? ";expires=" + t.toGMTString() : "";
    if (v != "") {
        v = v.toString().replace(/[!<}#;]/g, "");
    }
    if (d == null) {
        dD.cookie = n + "=" + v + (onCookieDomain ? "; domain=" + onCookieDomain: "") + ";path=" + onCookiePath;
    } else {
        dD.cookie = n + "=" + v + exp + (onCookieDomain ? ";domain=" + onCookieDomain: "") + ";path=" + onCookiePath;
    }
}
function ONS_SiteTrack() {
    onSiteCount = ONS_getCookie("OnSiteNum");
    if ((onSiteCount == "") || (onSiteCount == null)) {
        onSiteCount = "0";
    }
    ONS_SiteSave();
}
function ONS_PopSurvey(v1) {
    onSStage = ONS_getCookie(onCookieName + "S");
    if (onSStage < 8 && onSStage != null) {
        if (onTracking) {
            onChildWin = window.open(v1 + "?onsid=" + onSiteID + "&lang=" + onKey, "On2Survey", onWSetting);
            ONS_SiteSave("End");
        } else {
            onChildWin = window.open(v1 + "?3q=1&onsid=" + onSiteID + "&lang=" + onKey + "&loc=" + escape(onLocation), "On2Survey", onSSetting);
            ONS_setCookie(onCookieName + "S", 9, null, 2);
        }
    }
    ONS_setCookie(onCookieName, 0, onCookieDuration, 24);
    if (onTracking) {
        ONS_setCookie(onCookieName + "SV", 3, 90, 24);
    }
    ONS_setCookie(onCookieName + "S", "", -1, 24);
    ONS_setCookie(onCookieName + "C", "", -1, 24);
    ONS_IconHide("OnSiteFloatIcon");
    return false;
}
function ONS_SubmitInfo(v1, v2, v3, v4) {
    var strparam = "onsid=" + v1;
    var onPValue = new Image();
    strparam = strparam + "&onifo=" + escape(v3);
    strparam = strparam + "&onend=" + v4;
    strparam = strparam + "&rf=" + escape(ONS_getCookie(onCookieName + "C"));
    strparam = strparam + "&ul=" + navigator.userLanguage;
    strparam = strparam + "&sl=" + navigator.systemLanguage;
    strparam = strparam + "&lang=" + onKey;
    strparam = strparam + "&stype=" + onSurveyType;
    if (onLocation.indexOf("https") == -1) {
        onPValue.src = onServerPath + "?" + strparam;
    } else {
        onPValue.src = onServerSPath + "?" + strparam;
    }
}
function ONS_SiteSave(n) {
    onTStage = ONS_getCookie(onCookieName + "S");
    var t = new Date();
    var onSTime = Date.UTC(t.getFullYear(), t.getMonth() + 1, t.getDate(), t.getHours(), t.getMinutes(), t.getSeconds());
    var onSData = (onSData = ONS_getCookie("ONSData")) ? onSData: "";
    var onSInfo = (onSInfo = ONS_getCookie("ONSInfo")) ? onSInfo: "";
    var onSINum = (onSINum = ONS_getCookie("ONSINum")) ? onSINum: 0;
    var r1 = onSInfo.substring(onSInfo.lastIndexOf("^") + 1, onSInfo.length);
    if (onTStage < 8 && onTStage != null) {
        if (n == "End") {
            ONS_setCookie("ONSInfo", "", -1, 24);
            ONS_setCookie("ONSData", "", -1, 24);
            ONS_setCookie("ONSINum", "", -1, 24);
            ONS_setCookie(onCookieName + "S", 9, null, 2);
            onSData = onSData + "999" + onSInfo.substring(onSInfo.indexOf("^"), onSInfo.lastIndexOf("^") + 1) + ((onSTime - r1) / 1000) + "^";
            ONS_SubmitInfo(onSiteID, onLocation, onSData, "true");
        } else {
            onSINum = parseInt(onSINum) + 1;
            if (r1 != "") {
                onSData = onSData + onSInfo.substring(0, onSInfo.lastIndexOf("^") + 1) + ((onSTime - r1) / 1000) + "^";
            }
            onSInfo = onSINum + "^" + onLocation + "^" + onSTime;
            ONS_setCookie("ONSInfo", onSInfo, null, null);
            ONS_setCookie("ONSData", onSData, null, null);
            ONS_setCookie("ONSINum", onSINum, null, null);
            if (onSData.length >= 500) {
                ONS_SubmitInfo(onSiteID, onLocation, onSData, "false");
                ONS_setCookie("ONSData", onSData = "", null, null);
            }
        }
    }
}
function ONS_Tags() {
    var onTagSyntax = [["", "", "Provide<BR>Feedback"], ["", ""], ["", ""], ["", ""], ["", "", "&#12450;&#12531;&#12465;&#12540;&#12488;&#12395;&#31572;&#12360;&#12427;"], ["", "", "Umfrage starten"]];
    var onMsgText = "";
    var onMsgButt = "";
    var onMsgFoot = "";
    var newObj;
    var onFlashObj = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" pluginspage="http://www.macromedia.com/shockwave/download/" width="290" height="165" id="popup" align="middle"><param name="movie" value="' + onImagesPath + "popup" + onKey + '.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" />' + onFlashParam + '<embed src="' + onImagesPath + "popup" + onKey + '.swf" FlashVars="onKey=' + onKey + "&onImagesPath=" + onImagesPath + '" quality="high" wmode="transparent" width="290" height="165" name="popup" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" /></object>';
    var onIconObj = '<A href="' + onSurveyPath + '" target="OnSiteSurvey" onClick="return ONS_PopSurvey(this.href);" style="color:#0860a8;text-decoration:none" onmouseout="this.style.textDecoration=\'none\'" onmouseover="this.style.textDecoration=\'underline\'"><IMG src="' + onImagesPath + '/ico_graph.gif" border="0" style="opacity:0.6;filter:alpha(opacity=70)" alt="Click here to provide feedback!"><BR>' + onTagSyntax[onKey][2] + "</A>";
	
    if (!blnSecureSite) {
        newObj = dD.createElement("DIV");
        newObj.setAttribute("id", "OnSiteFloatWin");
        dD.body.appendChild(newObj);
        onObj = ONS_getObj("OnSiteFloatWin");
        onObj.style.display = "none";
        onObj.style.width = onFloatWidth + px;
        onObj.style.backgroundColor = "transparent";
        onObj.style.position = "absolute";
        onObj.style.zIndex = "10001";
        dD.getElementById("OnSiteFloatWin").innerHTML = onFlashObj;
    }
    newObj = dD.createElement("DIV");
    newObj.setAttribute("id", "OnSiteFloatIcon");
    dD.body.appendChild(newObj);
    onObj = ONS_getObj("OnSiteFloatIcon");
    onObj.style.display = "none";
    onObj.style.width = "60" + px;
    onObj.style.backgroundColor = "transparent";
    onObj.style.position = "absolute";
    onObj.style.zIndex = "10001";
    onObj.style.fontSize = "8pt";
    onObj.style.fontFamily = "verdana";
    onObj.style.textAlign = "center";
    dD.getElementById("OnSiteFloatIcon").innerHTML = onIconObj;
	
    return true;
}
function ONS_FloatHide(v1) {
    onTracking = false;
    ONS_InitTrack();
    if (eval(onObj) && onObj.id == "OnSiteFloatWin") {
        onObj.style.display = "none";
    }
    return;
}
function ONS_FloatHide2() {
    if (eval(onObj) && onObj.id == "OnSiteFloatWin") {
        onObj.style.display = "none";
    }
    return;
}
function ONS_InitTrack() {
    ONS_FloatHide2();
    if (!ONS_getCookie(onCookieName + "S")) {
        if (onTracking) {
            ONS_setCookie(onCookieName, 1, onCookieDuration, 24);
        } else {
            ONS_setCookie(onCookieName, 2, onCookieDuration, 24);
        }
        ONS_setCookie(onCookieName + "S", 1, null, 2);
        ONS_IconInit("OnSiteFloatIcon");
    }
    return;
}
function ONS_FloatInit(id) {
    onObj = ONS_getObj(id);
    onObj.style.left = 250 + px;
    onObj.style.top = 20 + px;
    onObj.style.display = "block";
    return;
}
function ONS_IconFloat(iX, iY, id) {
    var L = ONS_getObj(id);
    L.style.display = "block";
    this[id + "O"] = L;
    if (dD.layers) {
        L.style = L;
    }
    L.nX = iX;
    L.nY = iY;
    L.P = function(x, y) {
        this.style.left = x + px;
        this.style.top = y + px;
    };
    L.Fm = function() {
        this.nX = onScrollX() + (onClientWidth() - 100);
        this.nY = onScrollY() + (onClientHeight() - 70);
        this.P(this.nX, this.nY);
        onTimerID = setTimeout(this.id + "O.Fm()", 50);
    };
    return L;
}
function ONS_IconHide() {
    if (eval(onObj)) {
        clearTimeout(onTimerID);
        onObj.style.display = "none";
    }
}
function ONS_IconInit(id) {
	
    if (onLocation.indexOf("https") == -1 && onTracking) {
        ONS_SiteTrack();
    }
	
    onObj = ONS_getObj(id);
    onObj.style.display = "block";
    ONS_IconFloat( - 80, -80, id).Fm();
    return;
}
function ON_ChkStatus(id) {
	
    if (onblnStatus && id == "pop") {
        setTimeout("ONS_FloatInit('OnSiteFloatWin')", onPopDelay);
    } else {
        onChkStatus = onChkStatus + 1;
        if (onblnStatus == false && onBulletStatus.complete) {
            onblnStatus = true;
        }
        if (onChkStatus < 5) {
            setTimeout("ON_ChkStatus('" + id + "')", 1000);
        } else {
            if (onChildWin) {
                onChildWin.location = onErrorPath;
            }
        }
    }
}
function ONS_InitPop() {
    onAccess = [];
    onDisable = [];
    return true;
}
function ONS_SpecPop(qL, qA, qD, qP) {
    for (var c = 0; c < qD.length; c++) {
        if (qL.indexOf(qD[c]) != -1) {
            return false;
        }
    }
    if (qL.indexOf("https") != -1) {
        onImagesPath = onSecureImagePath;
        blnSecureSite = true;
    }
    if (qP == null) {
        if (qL.indexOf("https") != -1) {
            return false;
        }
        for (var c = 0; c < qA.length; c++) {
            if (qL.indexOf(qA[c][0]) != -1) {
                if ((qA[c][1] > onPopFreq && onPopFreq != 0) || qA[c][1] == 0) {
                    onPopFreq = qA[c][1];
                }
            }
        }
    }
    return true;
}
function ONS_Survey() {
	
    if (ONS_InitPop()) {
        if (ONS_SpecPop(onLocation, onAccess, onDisable, onSStage)) {
            onTagbln = ONS_Tags();
			
            if (onSStage == null) {
				
				// MC - added the parseFloat call (onPopFreq is a string)
                if ((ONS_getRandom() <= parseFloat(onPopFreq)) && onSurvey == null) {
                    onBullet.src = onBulletPath;
                    onBulletStatus.src = onStatusPath + "?rnd=" + (ONS_getRandom * 100);
                    ON_ChkStatus("pop");
                } else {
                    onTracking = false;
                    if (!onIndexPgr) {
                        ONS_InitTrack();
                    }
                }
            } else {
				
                if (onSStage < 8) {
                    ONS_IconInit("OnSiteFloatIcon");
                }
            }
        }
    }
}

function ONS_OnSite() {
	
    if ((onSIntel != null && onSStage != null) || (onSIntel == null && onSStage == null)) {
		
        onEXE = true;
    }
	// MC - Commented code out here to allow creation of Feedback icon
    if (onRun && onEXE /* && dD.cookie */) {
		
        //if (dD.cookie) {
			
            if (((onSIntel == 1 || onSIntel == 2) && (onSStage < 8 && onSStage != null)) || onSIntel == null) {
				
                ONS_Survey();
            }
        //}
    } else {
		
        onObj = ONS_getObj("OnSiteFloatIcon");
		
        if (onObj) {
			
            onObj.style.display = "none";
        }
    }
}
var onFloatWidth = 290;
var onServerPath = "http://onsite.hilton-research.com/engine/saventinfo.asp";
var onServerSPath = "https://onsite.hilton-research.com/engine/saventinfo.asp";
var onSurveyPath = "http://onsite.hilton-research.com/engine/savenfinal.asp";
var onStatusPath = "http://onsite.hilton-research.com/images/hilton.gif";
var onSiteCount = 0;
var onTagbln = false;
var onblnStatus = false;
var onChkStatus = 0;
var onEXE = false;
var onMX, onMDf, onMD, onMY, onMLf, onML;
var onFloatOn;
var onChildWin;
var onObj = null;
var onImage = new Image();
var onBullet = new Image();
var onBulletStatus = new Image();
var dD = document;
var nN = navigator;
var wN = window;
var px = dD.layers ? "": "px";
var onKey = "0";
var onTracking = true;
var onAccess, onDisable, blnSecureSite = false;
var onWSetting = "width=" + (screen.availWidth - 150) + ",height=" + (screen.availHeight - 100) + ",left=0,top=0,resizable=1,scrollbars=1";
var onSSetting = "width=550,height=400,left=" + (onClientWidth() - 560) + ",top=" + ((onClientHeight() - 300)) + ",resizable=1,scrollbars=0";
var onisNN = (nN.appName.indexOf("Netscape") != -1);
var onisIE = (nN.appName.indexOf("Microsoft") != -1);
var onisOP = (nN.userAgent.toLowerCase().indexOf("opera") > -1) ? true: false;
var onisNS = (nN.userAgent.toLowerCase().indexOf("mozilla") != -1) && (parseInt(nN.appVersion) >= 5);
var onisMAC = (nN.appVersion.indexOf("Macintosh") > -1);
var onSurveyType = "0";
var onLocation = ONS_getURL(dD.location, "");
var onReferrer = ONS_getURL(dD.referrer, "?");
var onIndexPgr = ONS_chkIndex(onLocation);
var onSIntel = ONS_getCookie(onCookieName);
var onSurvey = ONS_getCookie(onCookieName + "SV");
var onSStage = ONS_getCookie(onCookieName + "S");
var onCookie = ONS_getCookie(onCookieName + "C");
var onSiteID = ONS_getSiteID();
var pre_onload = window.onload;
if (onSIntel == 2) {
    onTracking = false;
}
/*
if (onCookie == null) {
    ONS_setCookie(onCookieName + "C", onReferrer, null, 24);
}


if (wN.attachEvent) {
	
    wN.attachEvent("onload", ONS_OnSite);
} else {
	
    if (dD.addEventListener) {
		
        dD.addEventListener("DOMContentLoaded", ONS_OnSite, false);


    }
}
*/
        /*############ End hiway/en_GB/js/plug/onsite.js ############*/
        /*############ Begin common/js/tracking/OptimostPageCode.js ############*/
var optimost = {
    A: {},
    C: {},
    D: document,
    L: document.location,
    M: [],
    Q: {},
    T: new Date(),
    U: "",
    V: "2.7",
    Enabled: true,
    ST: "script",
    SA: {
        type: "text/javascript"
    },
    I: function() {
        var s = this.L.search;
        var c = this.D.cookie;
        if (s.length > 3) {
            for (var a = s.substring(1).split("&"), i = 0, l = a.length; i < l; i++) {
                var p = a[i].indexOf("=");
                if (p > 0) {
                    this.Q[a[i].substring(0, p)] = unescape(a[i].substring(p + 1));
                }
            }
        }
        if (c.length > 3) {
            for (var a = c.split(";"), i = 0, b = a.length; i < b; i++) {
                var v = a[i].split("=");
                while (v[0].substring(0, 1) == " ") {
                    v[0] = v[0].substring(1, v[0].length);
                }
                if (v.length == 2) {
                    this.C[v[0]] = unescape(v[1]);
                }
            }
        }
    },
    B: function() {
        var n;
        this.A = {};
        var _o = this;
        this.A.D_ts = Math.round(_o.T.getTime() / 1000);
        this.A.D_tzo = _o.T.getTimezoneOffset();
        this.A.D_loc = _o.L.protocol + "//" + _o.L.hostname + _o.L.pathname;
        this.A.D_ckl = _o.D.cookie.length;
        this.A.D_ref = _o.D.referrer;
        if (typeof optrial == "object") {
            for (n in optrial) {
                this.A[n] = optrial[n];
            }
        }
        for (n in this.Q) {
            this.A[n] = this.Q[n];
        }
        for (n in this.C) {
            if (n.substring(0, 2) == "op") {
                this.A[n] = this.C[n];
            }
        }
    },
    S: function() {
        var q = "";
        for (var n in this.A) {
            if (this.A[n] != null && this.A[n] != "") {
                q += (q.length > 0 ? "&": (this.U.indexOf("?") > 0 ? "&": "?")) + n + "=" + escape(this.A[n]);
            }
        }
        return this.U + q;
    },
    SC: function(n, v, e, d) {
        var de = new Date();
        de.setTime(de.getTime() + e * 1000);
        this.D.cookie = n + "=" + escape(v) + ((e == null) ? "": ("; expires=" + de.toGMTString())) + "; path=/" + ((d == null) ? "": (";domain=" + d));
    },
    SLD: function() {
        var sld = this.D.domain;
        var dp = sld.split(".");
        var l = dp.length;
        if (l < 2) {
            sld = null;
        } else {
            if (!isNaN(dp[l - 1]) && !isNaN(dp[l - 2])) {
                sld = null;
            } else {
                sld = "." + dp[l - 2] + "." + dp[l - 1];
            }
        }
        return sld;
    },
    R: function(r, c, d, e) {
        if (this.Enabled) {
            var b = true;
            if (r < 1000) {
                b = (Math.floor(Math.random() * 1000) < r);
                if (c != null) {
                    if (this.C[c] != null) {
                        b = (this.C[c] != "mvt-no");
                    } else {
                        this.SC(c, b ? "mvt-yes": "mvt-no", e, d);
                    }
                }
            }
            if (b) {
                var t = "<" + this.ST + ' src="' + this.S() + '"';
                for (n in this.SA) {
                    t += (" " + n + '="' + this.SA[n] + '"');
                }
                t += "></" + this.ST + ">";
                this.D.write(t);
            }
        }
    },
    addModule: function(s, f) {
        this.M[s] = f;
    },
    displayModule: function(s) {
        if (typeof this.M[s] == "function") {
            this.M[s]();
        }
    },
    hasModules: function() {
        return count(this.M) > 0;
    }
};
optimost.I();
/*############ End common/js/tracking/OptimostPageCode.js ############*/
