function OpenCalendar(dayField, day, monthField, month, yearField, year, hotForm) {
              file = '/util/calendar.jsp?hotForm=' + hotForm;
            if ( dayField != null )
              file += '&dayField=' + dayField + '&day=' + day;
            if ( monthField != null )
              file += '&monthField=' + monthField + '&month=' + month;
            if ( yearField != null )
              file += '&yearField=' + yearField + '&year=' + year;
            window.open( file, "dates", 'width=200,height=200,resizable=1');
        }


function OpenCalendarRevised(dayField, day, monthField, month, yearField, year, hotForm, calNum, depMonthField, depDayField) {
              file = '/util/calendar.jsp?hotForm=' + hotForm;
            if ( dayField != null )
              file += '&dayField=' + dayField + '&day=' + day;
            if ( monthField != null )
              file += '&monthField=' + monthField + '&month=' + month;
            if ( yearField != null )
              file += '&yearField=' + yearField + '&year=' + year;
            if ( calNum != null )
              file += '&calNum=' + calNum;
            if ( depMonthField != null )
              file += '&depMonthField=' + depMonthField;
            if ( depDayField != null )
              file += '&depDayField=' + depDayField;
            window.open( file, "dates", 'width=200,height=200,resizable=1');
        }

  
  function loadDefaultDates() {
        var hotelArrival = new Date();
        var hotelDeparture = new Date();
        var hotelAdvanceArrival = 2;
        var hotelAdvanceDeparture = 4;
       
      
        hotelArrival.setDate( hotelArrival.getDate() + hotelAdvanceArrival );
        hotelDeparture.setDate( hotelDeparture.getDate() + hotelAdvanceDeparture );
       

        document.forms['hotForm'].arrivalMonth.value = hotelArrival.getMonth();
        document.forms['hotForm'].departureMonth.value = hotelDeparture.getMonth();
        document.forms['hotForm'].arrivalDay.value = hotelArrival.getDate();
        document.forms['hotForm'].departureDay.value = hotelDeparture.getDate();
	
    }

    function loadDates()
    {

        var calendar = new Date();
        var calendar2 = new Date();
        var cal
        var cal2
        var date;
        var month;
        var year;
        var date2;
        var month2;
        var year2;

        //Here is the variable to change for to advance the arrival Date
         var advanceArrival = 14;

        //Here is the variable to change for to advance the departure Date
         var advanceDeparture = 16;


        //Set the arrival Days
        calendar.setDate(calendar.getDate()+ advanceArrival);
        date = calendar.getDate();
        month = calendar.getMonth();

        //Set the Departure Days
        calendar2.setDate(calendar2.getDate()+advanceDeparture);
        date2 = calendar2.getDate();
        month2 = calendar2.getMonth();

        document.forms['hotForm'].arrivalMonth.value=month;
        document.forms['hotForm'].arrivalDay.value=date;
        document.forms['hotForm'].departureMonth.value=month2;
        document.forms['hotForm'].departureDay.value=date2;
    }

    function validateDepWindow(hotForm) {
        if (document.forms[hotForm].tempDepTime[document.forms[hotForm].tempDepTime.selectedIndex].value==('M')) {
            window.document.forms[hotForm].tripWindow.value='5';
            window.document.forms[hotForm].departureTime.value='7AM';
        } else if (document.forms[hotForm].tempDepTime[document.forms[hotForm].tempDepTime.selectedIndex].value==('A')) {
            window.document.forms[hotForm].tripWindow.value='5';
            window.document.forms[hotForm].departureTime.value='3PM';
        } else if (document.forms[hotForm].tempDepTime[document.forms[hotForm].tempDepTime.selectedIndex].value==('E')) {
            window.document.forms[hotForm].tripWindow.value='5';
            window.document.forms[hotForm].departureTime.value='8PM';
        } else if(document.forms[hotForm].tempDepTime[document.forms[hotForm].tempDepTime.selectedIndex].value==('ANT')) {
            window.document.forms[hotForm].tripWindow.value='9';
            window.document.forms[hotForm].departureTime.value='12PM';
        } else {
            window.document.forms[hotForm].tripWindow.value='5';
            window.document.forms[hotForm].departureTime.value=document.forms[hotForm].tempDepTime.value;
        }
    }

    function validateRetWindow(hotForm) {
        if (document.forms[hotForm].tempRetTime[document.forms[hotForm].tempRetTime.selectedIndex].value==('M')) {
            window.document.forms[hotForm].returnTime.value='7AM';
        } else if (document.forms[hotForm].tempRetTime[document.forms[hotForm].tempRetTime.selectedIndex].value==('A')) {
            window.document.forms[hotForm].returnTime.value='3PM';
        } else if (document.forms[hotForm].tempRetTime[document.forms[hotForm].tempRetTime.selectedIndex].value==('E')) {
            window.document.forms[hotForm].returnTime.value='8PM';
        } else if(document.forms[hotForm].tempRetTime[document.forms[hotForm].tempRetTime.selectedIndex].value==('ANT')) {
            window.document.forms[hotForm].returnTime.value='12PM';
        } else {
            window.document.forms[hotForm].returnTime.value=window.document.forms[hotForm].tempRetTime.value;
        }
    }
    // This script is intended for use with a minimum of Netscape 4 or IE 4.

    var isNav, isIE
    if (parseInt(navigator.appVersion) >= 4)
    { if (navigator.appName == "Netscape")
       { isNav = true }
       else
       { isIE = true }
    }

    function showLayer(layername)
    {
    if (isNav)
        { document.layers[layername].visibility = 'visible';}
        else //Must be IE
        { document.all[layername].style.visibility = 'visible';	}
    }

    function hideLayer(layername)
    {
        if (isNav)
        { document.layers[layername].visibility = 'hidden';	}
        else //Must be IE
        {document.all[layername].style.visibility = 'hidden';}
    }

	function OpenHcomHTU(file,name,width,height) {
		attr = "width=590,height=200,resizeable=1";
		window.open(file, name, attr);
	}

    function OpenHTU(file,name,width,height) {
        attr = "width=350,height=300,resizeable=1";
        window.open(file, name, attr);
    }

    function OpenBINPopup(numRoomsLeft,allotmentText) {
        window.open('/popups/hotels/binPopup.jsp?numRoomsLeft=' + numRoomsLeft + '&allotmentText=' + allotmentText,'BIN', 'width=350, height=300, scrollbars=no');
    }

    function OpenHcomBINPopup(numRoomsLeft,allotmentText) {
        window.open('/popups/hotels/binPopup.jsp?numRoomsLeft=' + numRoomsLeft + '&allotmentText=' + allotmentText,'BIN', 'width=590, height=200, scrollbars=no');
    }

    function OpenNonRefundPopup() {
        window.open('/popups/hotels/nonRefundPopup.jsp', '', 'width=350, height=300, scrollbars=no');
    }

    function OpenHcomNonRefundPopup() {
        window.open('/popups/hotels/nonRefundPopup.jsp', '', 'width=590, height=200, scrollbars=no');
    }

    function openPromoDetails(promo,description) {
        url = '/popups/hotels/hotPromotion.jsp?promo=';
        escapedPromo = escape(promo);
        escapedDescription = escape(description);
        url = url + escapedPromo + '&description=' + escapedDescription;
        window.open(url, 'test', 'width=350,height=300,resizable=1');
    }

    function openconvert(file,input) {
        window.open(file, input, 'width=640,height=215,resizable=1');
    }

    function UpdateCityCode() {
        document.aForm.pickUpCity.value = document.aForm.cityCode.options[document.aForm.cityCode.selectedIndex].value;
    }

    function MapPopup(theURL,winName,features) {
        // should no longer be used after travelnow release
        // goes live that includes hcom's maporama maps
        fileWindow = "/popups/maps/mapPopup.jsp?cmd=Find&HotelLyr=Off&ClickMode=Center";
        fileWindow += theURL;
        window.open(fileWindow,winName,features);
    }

    function MapPopup2(theURL,winName,features) {
        // BEGIN MAPORAMA CODE
        fileWindow = "/go.jsp?link=";
        // END MAPORAMA CODE

        // BEGIN IMAP CODE
        //fileWindow = "/popups/maps/mapPopup.jsp?cmd=Find&HotelLyr=Off&ClickMode=Center";
        // END IMAP CODE

        fileWindow += theURL;
        window.open(fileWindow,winName,features);
    }
	
	function submitRules() {
	   document.rules.submit();
	}

    function openPromo(file,attributes) {
       thor = window.open(file,'thor',attributes);
    }

    function loadPromo(file) {
       thor2 = window.open(file,'thor2','top=50,left=50,width=620,height=600,resizable=1,status=1,scrollbars=1');
       thor2.blur();
    }

    function showPromo(file) {
        if (thor2 == undefined){
            var thor2;
            thor2 = window.open(file,'thor2','top=50,left=50,resizable=1,status=1,scrollbars=1');
        }else{
            if (thor2.closed) {
                thor2 = window.open(file,'thor2','top=50,left=50,resizable=1,status=1,scrollbars=1');
            } else {
                thor2.focus();
            }
        }
    }

    function OpenInfo(file,input) {
        window.open(file, "PropInfo", 'scrollbars=1,width=520,height=100%,resizable=1');
    }

    function OpenRes(theURL) {
        window.open(theURL, "RES", 'scrollbars=1,width=800,height=600,resizable=1,status=1');
    }

    function OpenRateRules(file) {
        window.open(file, 'RateRules', 'width=440,height=100%,resizable=1,scrollbars=1');
    }

    function subpop(s) {//DH added this for new popcal
        addWindow = window.open(s,"hotForm","width=270,height=150,resizable=1,status=1,menubar=0,scrollbars=0,fullscreen=0");
        addWindow.focus();
    }

    function openphotos(file,input,width,height) {
        attr = "top=5,left=75,width=" + width + ",height=" + height + ",resizable=1,scrollbars=yes";
        window.open(file, input, attr);
    }

    //check the system date and set the time in advance if is equal to the same day as booking
    function checkTime(M,D,Y,obj)
    {
        var calendar = new Date();
        var date = calendar.getDate();
        var month = calendar.getMonth();
        var year = calendar.getYear();
        var hour = calendar.getHours();
        var date2 = D.value;
        var month2 = M.value;
        var year2 = Y.value;
        var newTime;

        if (obj == document.forms['hotForm'].dropOffTime)
        {
            hour += 3;
        }else{
            hour += 2;
        }

        if (month2 == month && date2 == date && year2 == year){
            if (hour == 0){
                newTime = '12AM';
            }else if (hour == 11){
                newTime = '12PM';
            }else if(hour < 11){
                newTime = hour + 'AM';
            }else if(hour > 11){
                hour -= 11;
                newTime = hour + 'PM';
            }
            obj.value=newTime;
        }else{
            obj.value='9AM';
        }
    }

    function openCondoWindow(file,input) {
        window.open(file, input,'width=300,height=540,resizable=1');
	}

    function openCancellationPolicy(file,input) {
        window.open(file, input, 'width=300,height=340, scrollbars = yes');
    }

    function checkDoubleSubmit(frm) {
        if (frm.frmsubmit.value == "Y" || frm.frmsubmit.value == "TWICE") {
            frm.frmsubmit.value = "TWICE";
            alert("You have already submitted this reservation once.  Please click 'OK' to continue. ");
            return(false);
        }
        frm.frmsubmit.value = "Y";
        return(true);
    }

  
