//start new script code
    // Checks if browser is Netscape 2.0x since the options array properties don't work with Netscape 2.0x
    function isBrowserSupp() {
        // Get the version of the browser
        version =  parseFloat( navigator.appVersion );

        if ( ( version >= 2.0 ) && ( version < 2.1 ) && ( navigator.appName.indexOf( "Netscape" ) != -1 ) ) {
            return false;
        } else {
            return true;
        }

        return true;
    }

    function isLeapYear( yrStr ) {
        var leapYear = false;
        var year = parseInt( yrStr, 10 );
        // every fourth year is a leap year
        if ( year % 4 == 0 ) {
            leapYear = true;
            // unless it's a multiple of 100
            if( year % 100 == 0 ) {
                leapYear = false;
                // unless it's a multiple of 400
                if( year % 400 == 0 ) {
                    leapYear=true;
                }
            }
        }
        return leapYear;
    }

    function getDaysInMonth( mthIdx, YrStr ) {
        // all the rest have 31
        var maxDays = 31
        // expect Feb. (of course)
        if( mthIdx == 1 ) {
            if( isLeapYear( YrStr ) ) {
                maxDays=29;
            } else {
                maxDays=28;
            }
        }

        // thirty days hath...
        if( mthIdx == 3 || mthIdx == 5 || mthIdx == 8 || mthIdx == 10 ) {
            maxDays=30;
        }
        return maxDays;
    }

    //the function which does some magic to the date fields
    // return non-zero if it is the last day of the month
    function adjustDate( mthIdx, Dt ) {
        var value = 0;

        var today = new Date()
        var theYear = parseInt( today.getYear(), 10 )

        if( mthIdx < today.getMonth() ) {
            theYear = ( parseInt( today.getYear(), 10 ) + 1 )
        }
        if( theYear < 100 ) {
            theYear = "19" + theYear
        } else {
            if( ( theYear - 100 ) < 10 ) {
                theYear = "0" + ( theYear - 100 )
            } else {
                theYear = ( theYear - 100 ) + ""
            }
            theYear = "20" + theYear
        }


        var numDays = getDaysInMonth( mthIdx, theYear );

        if( mthIdx == 1 ) {
            if( Dt.options.selectedIndex + 2 < numDays ) {
                return 0;
            } else {
                if( Dt.options.selectedIndex + 1 > numDays) {
                    Dt.options.selectedIndex=numDays - 1;
                }
                //check for leap year
                if( (Dt.options.selectedIndex + 1) == numDays ) {
                    return 1;
                } else {
                    return 4;
                }
            }
        }

        if( Dt.options.selectedIndex + 2 < numDays ) {
            value = 0;
        } else {
            if ( Dt.options.selectedIndex + 1 > numDays ) {
                Dt.options.selectedIndex--;
                value = 3;
            } else if ( Dt.options.selectedIndex + 1 == numDays ) {
                //index is 31 or 30
                value = 2;
            } else {
                value = 4;
            }
        }
        return value;
    }

    //changes departure month when arrival month is changed
    function amadChange( inM, inD, outM, outD ) {
        if ( !isBrowserSupp() ) {
            return;
        }

        var res = adjustDate( inM.options.selectedIndex, inD );
        if( res != 0 ) {
               outD.options.selectedIndex = 0;
               if ( inM.options.selectedIndex == 11 ) {
                    outM.options.selectedIndex = 0
               } else if( res == 4 ) {
                    outM.options.selectedIndex=inM.options.selectedIndex + 1;
                    outD.options.selectedIndex = 0;
               } else {
                    outM.options.selectedIndex=inM.options.selectedIndex + 1;
                    outD.options.selectedIndex = 1;
               }
        } else {
            outM.options.selectedIndex = inM.options.selectedIndex;
            if (outD.options.selectedIndex <= inD.options.selectedIndex) {
                outD.options.selectedIndex = inD.options.selectedIndex + 2;
            }
        }
        return;
    }


    function dmddChange( outM, outD ) {
        if ( !isBrowserSupp() ) {
            return;
        }

        adjustDate( outM.options.selectedIndex, outD );
        return;
    }

    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 );

        document.forms['airForm'].departureMonth.value = airArrival.getMonth();
        document.forms['airForm'].returnMonth.value = airDeparture.getMonth();
        document.forms['airForm'].departureDay.value = airArrival.getDate();
        document.forms['airForm'].returnDay.value = 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 );

        document.forms['carForm'].pickUpMonth.value = carArrival.getMonth();
        document.forms['carForm'].dropOffMonth.value = carDeparture.getMonth();
        document.forms['carForm'].pickUpDay.value = carArrival.getDate();
        document.forms['carForm'].dropOffDay.value = 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 );

        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 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 condoArrival = new Date();
        //var condoDeparture = new Date();

        var hotelAdvanceArrival = 21;
        var hotelAdvanceDeparture = 23;
        //var condoAdvanceArrival = 30;
        //var condoAdvanceDeparture = 37;
        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 );
        //condoArrival.setDate( condoArrival.getDate() + condoAdvanceArrival );
        //condoDeparture.setDate( condoDeparture.getDate() + condoAdvanceDeparture );

        document.forms['airForm'].departureMonth.value = airArrival.getMonth();
        document.forms['airForm'].returnMonth.value = airDeparture.getMonth();
        document.forms['airForm'].departureDay.value = airArrival.getDate();
        document.forms['airForm'].returnDay.value = airDeparture.getDate();

        document.forms['carForm'].pickUpMonth.value = carArrival.getMonth();
        document.forms['carForm'].dropOffMonth.value = carDeparture.getMonth();
        document.forms['carForm'].pickUpDay.value = carArrival.getDate();
        document.forms['carForm'].dropOffDay.value = carDeparture.getDate();

        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();

        //document.forms['vacForm'].arrivalMonth.value = condoArrival.getMonth();
        //document.forms['vacForm'].departureMonth.value = condoDeparture.getMonth();
        //document.forms['vacForm'].arrivalDay.value = condoArrival.getDate();
        //document.forms['vacForm'].departureDay.value = condoDeparture.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['myform'].arrivalMonth.value=month;
        document.forms['myform'].arrivalDay.value=date;
        document.forms['myform'].departureMonth.value=month2;
        document.forms['myform'].departureDay.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=0").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 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,"myform","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['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');
        }
	}

    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->

    var shipFirstName = "";
    var shipLastName = "";
    //var shipCompany = "";
    var shipAddress1 = "";
    var shipAddress2 = "";
    var shipCity = "";
    var shipStateProvince = "";
    var shipStateProvinceIndex = 0;
    var shipCountryIndex =0;
    var shipCountry="";
    var shipPostalCode = "";
    var shipHomePhone = "";
    var shipWorkPhone = "";
    var shipExtension = "";
    var shipFaxPhone = "";

    function InitSaveVariables(form) {
        shipFirstName = form.firstName.value;
        shipLastName = form.lastName.value;
        //shipCompany = form.company.value;
        shipAddress1 = form.address1.value;
        shipAddress2 = form.address2.value;
        shipCity = form.city.value;
        shipPostalCode = form.postalCode.value;
        shipStateProvinceIndex = form.stateProvince.selectedIndex;
        shipStateProvince = form.stateProvince[shipStateProvinceIndex].value;
        shipCountryIndex = form.country.selectedIndex;
        shipCountry= form.country[shipCountryIndex].value;
        shipHomePhone = form.homePhone.value;
        shipWorkPhone = form.workPhone.value;
        shipExtension = form.extension.value;
        shipFaxPhone = form.faxPhone.value;
    }

    function ShipToBillPerson(form) {
        if (form.sameshipping.checked) {
            InitSaveVariables(form);
            form.shipFirstName.value = form.firstName.value;
            form.shipLastName.value = form.lastName.value;
            form.shipCompany.value = form.company.value;
            form.shipAddress1.value = form.address1.value;
            form.shipAddress2.value = form.address2.value
            form.shipCity.value = form.city.value;
            form.shipPostalCode.value = form.postalCode.value;
            form.shipStateProvince.selectedIndex = form.stateProvince.selectedIndex;
            form.shipCountry.selectedIndex = form.country.selectedIndex;
            form.shipHomePhone.value = form.homePhone.value;
            form.shipWorkPhone.value = form.workPhone.value;
            form.shipExtension.value = form.extension.value;
            form.shipFaxPhone.value = form.faxPhone.value;
        } else {
            form.shipFirstName.value = shipFirstName;
            form.shipLastName.value = shipLastName;
            //form.shipCompany.value = shipCompany;
            form.shipAddress1.value = shipAddress1;
            form.shipAddress2.value = shipAddress2;
            form.shipCity.value = shipCity;
            form.shipPostalCode.value = shipPostalCode;
            form.shipStateProvince.selectedIndex = shipStateProvinceIndex;
            form.shipCountry.selectedIndex =shipCountryIndex;
            form.shipHomePhone.value = shipHomePhone;
            form.shipWorkPhone.value = shipWorkPhone;
            form.shipExtension.value = shipExtension;
            form.shipFaxPhone.value = shipFaxPhone;
        }
    }

var infantNumber= 0;
var childrenNumber = 0;
var childrenForm = 0;
var infantForm = 0;

function moreThanOneInfant(form){
    infantForm = document.forms['AvailRequester'].infants;
    infantNumber= infantForm.value;
    if(document.forms['AvailRequester'].children.selectedIndex>1){
        headerDisplay.style.visibility="visible";
        childrenDisplay.style.display="block";
        childrenDisplay.style.visibility="visible";
        showChildren(document.forms['AvailRequester'].children.selectedIndex-1);
    }

    var infTotal = infantForm.value;
    var max=6;
    if(0==infantForm.value){
        if(0==childrenForm.value){
            headerDisplay.style.display="none";
            showChildren(0);
        }
        showInfants(0);
        infantDisplay.style.display="none";
    }else{
        showInfants(infantNumber);
        if(headerDisplay.style.display=="none"){
            headerDisplay.style.visibility="hidden";
            headerDisplay.style.display="block";
        }
        headerDisplay.style.visibility="visible";

        infantDisplay.style.display="block";
        infantDisplay.style.visibility="visible";
    }
}

function moreThanOne(form){
    childrenForm = document.forms['AvailRequester'].children;
    childrenNumber= childrenForm.value;

    if(document.forms['AvailRequester'].infants.selectedIndex>1){
        headerDisplay.style.visibility="visible";
        infantDisplay.style.display="block";
        infantDisplay.style.visibility="visible";
        showInfants(document.forms['AvailRequester'].infants.selectedIndex-1);
    }

    var total=childrenForm.value;

    var max=6;
    if(0==childrenForm.value){
        if(0==infantForm.value){
            headerDisplay.style.display="none";
            showInfants(0);
        }
        showChildren(0);
        childrenDisplay.style.display="none";
    }else{
        showChildren(childrenNumber);

        if(headerDisplay.style.display=="none"){
            headerDisplay.style.visibility="hidden";
            headerDisplay.style.display="block";
        }
        childrenDisplay.style.display="block";
        childrenDisplay.style.visibility="visible";
        headerDisplay.style.visibility="visible";
    }
}

function showChildren(numberOfChildren){
    for(i=1; i<= numberOfChildren;i++){
        eval("showChildHeader"+i+".style.visibility='visible'");
        eval("showChild"+i+".style.visibility='visible'");
    }
    for(j=6; j > numberOfChildren; j--){
        var ptc=j-1;
        eval("document.forms['AvailRequester'].childPTC["+ptc+"].selectedIndex=0");
        eval("showChildHeader"+j+".style.visibility='hidden'");
        eval("showChild"+j+".style.visibility='hidden'");
    }
}

function showInfants(numberOfInfants){
    for(i=1; i<= numberOfInfants;i++){
        eval("showInfantHeader"+i+".style.visibility='visible'");
        eval("showInfant"+i+".style.visibility='visible'");
    }
    for(j=6; j > numberOfInfants; j--){
    var ptc=j+5;
        eval("document.forms['AvailRequester'].childPTC["+ptc+"].selectedIndex=0");
        eval("showInfantHeader"+j+".style.visibility='hidden'");
        eval("showInfant"+j+".style.visibility='hidden'");
        eval("showInfant"+j+".style.display='block'");
    }
}

function processInfants( inf, ins ) {
    var totalInfants = inf+ins;
    var ptc=5;
    while (totalInfants > -1) {
        //alert(totalInfants);
        //alert(ptc);

        if(inf>-1) {
            eval("document.forms['AvailRequester'].childPTC["+ptc+"].selectedIndex=1");
            inf--;
        } else if(ins > -1) {
            eval("document.forms['AvailRequester'].childPTC["+ptc+"].selectedIndex=2");
            ins--;
        }
        totalInfants = inf+ins;
        ptc++;
    }
}
 function processChildren( c2, c3,c4, c5, c6, c7, c8, c9, c10, c11) {
    var totalChildren = -1;
    var ptc=0;

    if(c2>-1){
        totalChildren++;
//alert("c2: "+totalChildren);
    }

    if(c3>-1){
        totalChildren++;
//alert("c3: "+totalChildren);
    }

    if(c4>-1){
        totalChildren++;
//alert("c4: "+totalChildren);
    }

    if(c5>-1){
        totalChildren++;
//alert("c5: "+totalChildren);
    }

    if(c6>-1){
        totalChildren++;
//alert("c6: "+totalChildren);
    }

    if(c7>-1){
        totalChildren++;
//alert("c7: "+totalChildren);
    }

    if(c8>-1){
        totalChildren++;
//alert("c8: "+totalChildren);
    }

    if(c9>-1){
        totalChildren++;
//alert("c9: "+totalChildren);
    }

    if(c10>-1){
        totalChildren++;
//alert("c10: "+totalChildren);
    }

    if(c11>-1){
        totalChildren++;
//alert("c11: "+totalChildren);
    }

    if(totalChildren < 5){
    eval("document.forms['AvailRequester'].childPTC["+5+"].selectedIndex=0");
    }

    while (totalChildren > -1) {
        if(c2 > -1) {
            eval("document.forms['AvailRequester'].childPTC["+ptc+"].selectedIndex=1");
            c2--;
            totalChildren--;
            ptc++;
        } else if(c3 > -1) {
            eval("document.forms['AvailRequester'].childPTC["+ptc+"].selectedIndex=2");
            c3--;
            totalChildren--;
            ptc++;
        }else if(c4 > -1) {
            eval("document.forms['AvailRequester'].childPTC["+ptc+"].selectedIndex=3");
            c4--;
            totalChildren--;
            ptc++;
        }else if(c5 > -1) {
            eval("document.forms['AvailRequester'].childPTC["+ptc+"].selectedIndex=4");
            c5--;
            totalChildren--;
            ptc++;
        }else if(c6 > -1) {
            eval("document.forms['AvailRequester'].childPTC["+ptc+"].selectedIndex=5");
            c6--;
            totalChildren--;
            ptc++;
        }else if(c7 > -1) {
            eval("document.forms['AvailRequester'].childPTC["+ptc+"].selectedIndex=6");
            c7--;
            totalChildren--;
            ptc++;
        }else if(c8 > -1) {
            eval("document.forms['AvailRequester'].childPTC["+ptc+"].selectedIndex=7");
            c8--;
            totalChildren--;
            ptc++;
        }else if(c9 > -1) {
            eval("document.forms['AvailRequester'].childPTC["+ptc+"].selectedIndex=8");
            c9--;
            totalChildren--;
            ptc++;
        }else if(c10 > -1) {
            eval("document.forms['AvailRequester'].childPTC["+ptc+"].selectedIndex=9");
            c10--;
            totalChildren--;
            ptc++;
        }else if(c11 > -1) {
            eval("document.forms['AvailRequester'].childPTC["+ptc+"].selectedIndex=10");
            c11--;
            totalChildren--;
            ptc++;
        } else {
            totalChildren = -1;
        }
    }
}
