    function OpenWindow(file, name, width, height) {
        OpenWindow(file, name, width, height, false);
    }

    function OpenWindow(file, name, width, height, showLeftTopScrollbar) {
        var attr = "";
        if(showLeftTopScrollbar) {
            attr += "top=50,left=50,scrollbars=1,";
        }
        attr += "width=" + width + ",height=" + height + ",resizeable=1";
        window.open(file, name, attr);
    }

    function openWin(fileName) {
       thor = window.open(fileName,'thor','top=200,left=220,width=275,height=450,resizable=1,scrollbars=yes');
    }

    function openWindow(fileName)
    {
       thor = window.open(fileName,'thor','top=200,left=220,width=275,height=450,resizable=1,scrollbars=yes');
    }

    function MM_openBrWindow(theURL,winName,features) { //v2.0
        window.open(theURL,winName,features);
    }

    function displayHotel(){
        hotelTable.style.visibility='visible';
        hotelTable.style.display='block';
        //hotelsImage.style.visibility='visible';
        //hotelsImage.style.display='block';
        indexSelect.hotel.checked='true';

        noCar();
        noFlight();
        //noRental();
        noCruise();
    }
    function displayCar(){
        carTable.style.visibility='visible';
        carTable.style.display='block';
        //carsImage.style.visibility='visible';
        //carsImage.style.display='block';
        indexSelect.car.checked='true';

        noHotel();
        noFlight();
        //noRental();
        noCruise();
    }
    function displayFlight(){
        flightTable.style.visibility='visible';
        flightTable.style.display='block';
        //flightsImage.style.visibility='visible';
        //flightsImage.style.display='block';
        indexSelect.air.checked='true';
        //loadDates();

        noCar();
        noHotel();
        //noRental();
        noCruise();
    }

    //function displayRental(){
    //  rentalTable.style.visibility='visible';
    /// rentalTable.style.display='block';
    //  rentalImage.style.visibility='visible';
    //  rentalImage.style.display='block';
    //    indexSelect.rental.checked='true';

    //  noCar();
    //  noHotel();
    //  noFlight();
    //  //noCruise();
    //}

    function displayCruise(){
        noCar();
        noHotel();
        noFlight();
        //noRental();
        cruiseTable.style.visibility='visible';
        cruiseTable.style.display='block';
        //cruisesImage.style.visibility='visible';
        //cruisesImage.style.display='block';
        indexSelect.cruise.checked='true';
    }

    //function noRental(){
        //rentalTable.style.display='block';
        //rentalTable.style.display='none';
        //rentalTable.style.visibility='hidden';
        //rentalImage.style.visibility='hidden';
        //rentalImage.style.display='none';
    //}

    function noCar(){
        //carTable.style.display='block';
        carTable.style.display='none';
        carTable.style.visibility='hidden';
        //carsImage.style.visibility='hidden';
        //carsImage.style.display='none';
    }

    function noFlight(){
        //flightTable.style.display='block';
        flightTable.style.display='none';
        flightTable.style.visibility='hidden';
        //flightsImage.style.visibility='hidden';
        //flightsImage.style.display='none';
    }

    function noHotel(){
        //hotelTable.style.display='block';
        hotelTable.style.display='none';
        hotelTable.style.visibility='hidden';
        //hotelsImage.style.visibility='hidden';
        //hotelsImage.style.display='none';
    }

    function noCruise(){
        //cruiseTable.style.display='block';
        cruiseTable.style.display='none';
        cruiseTable.style.visiblity='hidden';
        //cruisesImage.style.visibility='hidden';
        //cruisesImage.style.display='none';
    }

    function newImage(arg) {
        if (document.images) {
            rslt = new Image();
            rslt.src = arg;
            return rslt;
        }
    }

    function changeImages() {
        if (document.images && (preloadFlag == true)) {
            for (var i=0; i<changeImages.arguments.length; i+=2) {
                document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
            }
        }
    }

    var preloadFlag = false;
    function preloadImages() {
        if (document.images) {
            stay_01_over = newImage("/images/stay_01.gif");
            stay_02_over = newImage("/images/stay_02.gif");
            fly_01_over = newImage("/images/fly_01.gif");
            fly_02_over = newImage("/images/fly_02.gif");
            drive_01_over = newImage("/images/drive_01.gif");
            drive_03_over = newImage("/images/drive_03.gif");
            preloadFlag = true;
        }
    }

        function go(loc) {
            window.location.href = loc;
        }

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

        function OpenCalendar(dayField, day, monthField, month, yearField, year, formName) {
              file = '/util/calendar.jsp?formName=' + formName;
            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, formName, calNum, depMonthField, depDayField) {
              file = '/util/calendar.jsp?formName=' + formName;
            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 loadAirDates() {
        var airArrival = new Date();
        var airDeparture = new Date();

        var airAdvanceArrival = 14;
        var airAdvanceDeparture = 15;

        airArrival.setDate( airArrival.getDate() + airAdvanceArrival );
        airDeparture.setDate( airDeparture.getDate() + airAdvanceDeparture );

        setSelectValue(document.forms['airForm'].departureMonth, airArrival.getMonth());
        setSelectValue(document.forms['airForm'].departureDay, airArrival.getDate());
        setSelectValue(document.forms['airForm'].returnMonth, airDeparture.getMonth());
        setSelectValue(document.forms['airForm'].returnDay, airDeparture.getDate());
    }

   function loadCarDates() {
        var carArrival = new Date();
        var carDeparture = new Date();

        var carAdvanceArrival = 7;
        var carAdvanceDeparture = 8;

        carArrival.setDate( carArrival.getDate() + carAdvanceArrival );
        carDeparture.setDate( carDeparture.getDate() + carAdvanceDeparture );

        setSelectValue(document.forms['carForm'].pickUpMonth, carArrival.getMonth());
        setSelectValue(document.forms['carForm'].pickUpDay, carArrival.getDate());
        setSelectValue(document.forms['carForm'].dropOffMonth, carDeparture.getMonth());
        setSelectValue(document.forms['carForm'].dropOffDay, carDeparture.getDate());
    }

   function loadHotelDates() {
        var hotelArrival = new Date();
        var hotelDeparture = new Date();

        var hotelAdvanceArrival = 21;
        var hotelAdvanceDeparture = 23;

        hotelArrival.setDate( hotelArrival.getDate() + hotelAdvanceArrival );
        hotelDeparture.setDate( hotelDeparture.getDate() + hotelAdvanceDeparture );
        
        setSelectValue(document.forms['hotForm'].arrivalMonth, hotelArrival.getMonth());
        setSelectValue(document.forms['hotForm'].arrivalDay, hotelArrival.getDate());
        setSelectValue(document.forms['hotForm'].departureMonth, hotelDeparture.getMonth());
        setSelectValue(document.forms['hotForm'].departureDay, hotelDeparture.getDate());
    }
    
    function setSelectValue(select, value) {
        // given a <select> element, set the index to 
        // the option with the specified value.
        for (i = 0; i < select.length; i++) {
            if (select[i].value == value) {
                select.selectedIndex = i;
                break;
            }    
        }
    }

    function loadCondoDates() {
        var hotelArrival = new Date();
        var hotelDeparture = new Date();

        var hotelAdvanceArrival = 21;
        var hotelAdvanceDeparture = 28;

        hotelArrival.setDate( hotelArrival.getDate() + hotelAdvanceArrival );
        hotelDeparture.setDate( hotelDeparture.getDate() + hotelAdvanceDeparture );

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

   function loadDefaultDates() {
        var airArrival = new Date();
        var airDeparture = new Date();
        var carArrival = new Date();
        var carDeparture = new Date();
        var hotelArrival = new Date();
        var hotelDeparture = new Date();

        var hotelAdvanceArrival = 21;
        var hotelAdvanceDeparture = 23;
        var carAdvanceArrival = 7;
        var carAdvanceDeparture = 8;
        var airAdvanceArrival = 14;
        var airAdvanceDeparture = 15;

        airArrival.setDate( airArrival.getDate() + airAdvanceArrival );
        airDeparture.setDate( airDeparture.getDate() + airAdvanceDeparture );
        carArrival.setDate( carArrival.getDate() + carAdvanceArrival );
        carDeparture.setDate( carDeparture.getDate() + carAdvanceDeparture );
        hotelArrival.setDate( hotelArrival.getDate() + hotelAdvanceArrival );
        hotelDeparture.setDate( hotelDeparture.getDate() + hotelAdvanceDeparture );

        setSelectValue(document.forms['airForm'].departureMonth, airArrival.getMonth());
        setSelectValue(document.forms['airForm'].departureDay, airArrival.getDate());
        setSelectValue(document.forms['airForm'].returnMonth, airDeparture.getMonth());
        setSelectValue(document.forms['airForm'].returnDay, airDeparture.getDate());

        setSelectValue(document.forms['carForm'].pickUpMonth, carArrival.getMonth());
        setSelectValue(document.forms['carForm'].pickUpDay, carArrival.getDate());
        setSelectValue(document.forms['carForm'].dropOffMonth, carDeparture.getMonth());
        setSelectValue(document.forms['carForm'].dropOffDay, carDeparture.getDate());

        setSelectValue(document.forms['hotForm'].arrivalMonth, hotelArrival.getMonth());
        setSelectValue(document.forms['hotForm'].arrivalDay, hotelArrival.getDate());
        setSelectValue(document.forms['hotForm'].departureMonth, hotelDeparture.getMonth());
        setSelectValue(document.forms['hotForm'].departureDay, 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();

        setSelectValue(document.forms['myform'].arrivalMonth, hotelArrival.getMonth());
        setSelectValue(document.forms['myform'].arrivalDay, hotelArrival.getDate());
        setSelectValue(document.forms['myform'].departureMonth, hotelDeparture.getMonth());
        setSelectValue(document.forms['myform'].departureDay, hotelDeparture.getDate());
    }
    
    function initializeSearchFormDates(startMonth, startDay, endMonth, endDay, startAdvance, endAdvance) {
        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 = startAdvance;

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


        //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();
              

        startMonth.value=month;
        startDay.value=date;
        endMonth.value=month2;
        endDay.value=date2; 
    }

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

    function validateRetWindow(formName) {
        if (document.forms[formName].tempRetTime[document.forms[formName].tempRetTime.selectedIndex].value==('M')) {
            window.document.forms[formName].returnTime.value='7AM';
        } else if (document.forms[formName].tempRetTime[document.forms[formName].tempRetTime.selectedIndex].value==('A')) {
            window.document.forms[formName].returnTime.value='3PM';
        } else if (document.forms[formName].tempRetTime[document.forms[formName].tempRetTime.selectedIndex].value==('E')) {
            window.document.forms[formName].returnTime.value='8PM';
        } else if(document.forms[formName].tempRetTime[document.forms[formName].tempRetTime.selectedIndex].value==('ANT')) {
            window.document.forms[formName].returnTime.value='12PM';
        } else {
            window.document.forms[formName].returnTime.value=window.document.forms[formName].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 OpenSizedHTU(file, name, width, height) {
        window.open(file, name, "width=" + width + ",height=" + height + ",resizeable=1,status=no").focus();
    }


    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 openMapWindow(url) {
        window.open(url, 'map', 'width=650,height=800,top=170,left=162,toolbar=no,location=no,directories=no,status=no,menubar=no,dependent=yes,resizable=no,status=no,scrollbars=yes');
    }
    
    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,"myform","width=270,height=150,resizable=1,status=1,menubar=0,scrollbars=0,fullscreen=0");
        addWindow.focus();
    }

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

    //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['aForm'].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);
    }

    function OpenFAQ(file) {
        window.open(file, 'FAQ', 'width=500,height=300,resizable=1');
    }

    function OpenFAQBig(file) {
        window.open(file, 'FAQBig', 'width=830,height=630,resizable=1,scrollbars=1');
    }

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

    function OpenFAQ640(file) {
        window.open(file, 'FAQ', 'width=660,height=480,resizable=1,scrollbars=1');
    }

    function OpenFAQPopUp(file) {
        window.open(file, 'FAQ', 'width=500,height=275,resizable=1');
    }

    function editReservePage(fieldToJumpTo) {
        setCookie('reserveField',fieldToJumpTo)
        history.back();
    }

    function goToAnchor(reserveField) {
        window.location.hash=reserveField;
    }

    function setCookie(name, value, expires, path, domain, secure) {
      var curCookie = name + "=" + escape(value) +
          ((expires) ? "; expires=" + expires.toGMTString() : "") +
          ((path) ? "; path=" + path : "") +
          ((domain) ? "; domain=" + domain : "") +
          ((secure) ? "; secure" : "");
      document.cookie = curCookie;
    }

    function getCookie(name) {
      var dc = document.cookie;
      var prefix = name + "=";
      var begin = dc.indexOf(prefix);
      if (begin == -1)
        return null;
      var end = document.cookie.indexOf(";", begin);
      if (end == -1)
        end = dc.length;
      return unescape(dc.substring(begin + prefix.length, end));
    }

    function deleteCookie(name) {
        document.cookie = name + '=false; expires=Fri, 27 Jul 2001 02:47:11 UTC;path=/';
    }

    function opentnpr(file,input) {
        if (file == '/popups/airlines/valued_airline_popup.jsp') {
            window.open(file, input, 'width=300,height=200,resizable=1');
        } else if (file == '/popups/hotels/sir.jsp') {
            window.open(file, input,'width=300,height=500,resizable=1');
        } else if (file == '/popups/hotels/condo.jsp') {
            window.open(file, input,'width=300,height=540,resizable=1');
        } else {
            window.open(file, input,'width=300,height=450,resizable=1');
        }
    }

    function toggleDiv(divID, state){
        if(document.layers){ //netscape 4+

           document.layers[divID].visibility = state ? "show" : "hide";
           document.layers[divID].display = state ? "block" : "none";

        } else if(document.getElementById) { //netscape 6 internetExplorer 5+

            document.getElementById(divID).style.visibility = state ? "visible" : "hidden";
            document.getElementById(divID).style.display = state ? "block" : "none";

        } else {    //Internet Explorer 4

            document.all[divID].style.visibility = state ? "visible" : "hidden";
            document.all[divID].style.display = state ? "block" : "none";

        }
    }

