function initializeDates(){ var d = new Date(); d.setMonth(d.getMonth(), d.getDate()+14); document.forms['myForm'].elements['dateField'].value = getFormattedMonth(d.getMonth()) + "/" + getFormattedDay(d.getDate()) + "/" + d.getYear(); } function travelNowize() { // travelnow provided this code which takes the "dateField" and "numberOfNights" and does the math // to get a checkin and checkout date var intNight = document.forms['myForm'].numberOfNights.value; var dt = new Date(document.forms['myForm'].dateField.value); var adt = new Date(dt.getYear(), dt.getMonth(), dt.getDate()+(document.forms['myForm'].numberOfNights.selectedIndex+1) ); document.forms['myForm'].departureDay.value = adt.getDate(); document.forms['myForm'].departureMonth.value = adt.getMonth(); document.forms['myForm'].arrivalDay.value = dt.getDate(); document.forms['myForm'].arrivalMonth.value = dt.getMonth(); } function group() { if (document.myForm.numberOfRooms.selectedIndex == 8) { window.location="http://travel.ian.com/index.jsp?pageName=groups&cid=143130&locale=en_US"; return false; } else { travelNowize(); return true; } } function getFormattedMonth(themonth) { if (themonth < 9) { switch(themonth) { case 0: return '01'; case 1: return '02'; case 2: return '03'; case 3: return '04'; case 4: return '05'; case 5: return '06'; case 6: return '07'; case 7: return '08'; case 8: return '09'; } } return themonth+1; } function getFormattedDay(theday) { if (theday < 10) { switch(theday) { case 1: return '01'; case 2: return '02'; case 3: return '03'; case 4: return '04'; case 5: return '05'; case 6: return '06'; case 7: return '07'; case 8: return '08'; case 9: return '09'; } } return theday; } function update(themonth,theday, theyear){ document.forms[fName].elements['dateField'].value = getFormattedMonth(themonth) + "/" + getFormattedDay(theday) + "/" + theyear; testWindow.close(); } function loadCalendar(viewMonth) { testWindow.document.close(); testWindow.document.open(); var day_of_week = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); var month_of_year = new Array("January","February","March","April","May","June","July","August","September","October","November","December"); var dateObj = new Date(); var year = dateObj.getYear(); // Returns year var month = dateObj.getMonth(); // Returns month (0-11) var today = dateObj.getDate(); // Returns day (1-31) var weekday = dateObj.getDay(); // Returns day (1-31) var DAYS_OF_WEEK = 7; // "constant" for number of days in a week var DAYS_OF_MONTH = 31; // "constant" for number of days in a month var cal; // Used for printing if (viewMonth < month) { year = year + 1; } if(year < 1900){ year += 1900; //done to solve the problem of netscape and mozilla returning year in form 10X for years > 2000 } month = viewMonth; dateObj.setDate(1); // Start the calendar day at '1' dateObj.setMonth(month); // Start the calendar month at now dateObj.setYear((year)); // VARIABLES FOR FORMATTING var TR_start = ''; var TR_end = ''; var highlight_start = '
'; var highlight_end = '
'; var TD_start = '
'; var TD_end = '
'; var prevM = month - 1; var nextM = month + 1; if (nextM == 12) { nextM = 0; } if (prevM == -1) { prevM = 11; } // BEGIN CODE FOR CALENDAR cal = 'Calendar'; cal += ""; cal += '
'; cal += '' + TR_start; cal += '
'; cal += month_of_year[month] + ' ' + year + '' + TD_end + TR_end; cal += TR_start; /////////////////////////////////// // DO NOT EDIT BELOW THIS POINT // /////////////////////////////////// // LOOPS FOR EACH DAY OF WEEK for(index=0; index < DAYS_OF_WEEK; index++) { // PRINTS DAY cal += TD_start + day_of_week[index] + TD_end; } cal += TD_end + TR_end; cal += TR_start; // FILL IN BLANK GAPS UNTIL TODAY'S DAY for(index=0; index < dateObj.getDay(); index++) { cal += TD_start + ' ' + TD_end; } // LOOPS FOR EACH DAY IN CALENDAR for(index=0; index < DAYS_OF_MONTH; index++) { if( dateObj.getDate() > index ) { // RETURNS THE NEXT DAY TO PRINT week_day =dateObj.getDay(); // START NEW ROW FOR FIRST DAY OF WEEK if(week_day == 0) { cal += TR_start; } if(week_day != DAYS_OF_WEEK) { // SET VARIABLE INSIDE LOOP FOR INCREMENTING PURPOSES var day = dateObj.getDate(); // PRINTS DAY cal += TD_start + "" + day + "" + TD_end; } // END ROW FOR LAST DAY OF WEEK if(week_day == DAYS_OF_WEEK) { cal += TR_end; } } // INCREMENTS UNTIL END OF THE MONTH dateObj.setDate(dateObj.getDate()+1); }// end for loop cal += '

'; cal += '
<<    '; cal += '>>

'; cal += '
close
'; cal += ''; // PRINT CALENDAR testWindow.document.write(cal); } var testWindow; var fieldName; var fName; function openCalendar(formName, field) { fieldName=field; fName=formName; testWindow = window.open('','dates','width=300,height=300,resizable=1,status=1,menubar=0,location=0'); var month = document.forms[fName].elements[fieldName].value; var dateRegExp = new RegExp("^(([1][0-2])|([0]?[1-9]))/(([0123]?[0-9])|[0-9])(/((20)?[0-9]{2}))?"); //looks for mm/dd if (month.match(dateRegExp)) { month = document.forms[fName].elements[fieldName].value.split("/")[0] - 1; } else { month = new Date().getMonth(); } loadCalendar(month); } // NOTE: customize variables in this javascript block as appropriate. var defaultAdults="2"; var cellStyle=" class='myFormhdr'"; var childHelp="Please provide the ages of children in each room. Children's ages should be their age at the time of travel."; var adultHelp=""; var textRooms="Rooms:"; var textAdults="Adults: (age 18+)"; var textChildren="Children: (0-17)"; var textChildError="Please specify the ages of all children."; var pad=''; // NOTE: Question marks ("?") get replaced with a numeric value var textRoomX="Room ?:"; var textChildX="Child ?:"; var isFireFox=navigator.userAgent.indexOf("Firefox") != -1; var adultsPerRoom=new Array(defaultAdults); var childrenPerRoom=new Array(); var childAgesPerRoom=new Array(); var numRooms=1; var maxChildren=0; if (isFireFox) { document.write(''); } refresh(); function setChildAge(room, child, age) { if (childAgesPerRoom[room] == null) { childAgesPerRoom[room] = new Array(); } childAgesPerRoom[room][child] = age; } function setNumAdults(room, numAdults) { adultsPerRoom[room] = numAdults; } function setNumChildren(room, numChildren) { childrenPerRoom[room] = numChildren; refresh(); } function setNumRooms(x) { numRooms = x; for (i = 0; i < x; i++) { if (adultsPerRoom[i] == null) { adultsPerRoom[i] = 2; } if (childrenPerRoom[i] == null) { childrenPerRoom[i] = 0; } } refresh(); } function renderRoomSelect() { var x = ''; x += ''; return x; } function refresh() { maxChildren = 0; for (var i = 0; i < numRooms; i++) { if (childrenPerRoom[i] > maxChildren) { maxChildren = childrenPerRoom[i]; } } var x = ''; if (adultHelp.length > 0) { x = adultHelp + "

\n"; } if (numRooms > 8) { x += textRooms; x += renderRoomSelect(); } else { x += '\n'; x += ''+textRooms+pad+''; if (numRooms > 1) { x += ' '; } x += ''+textAdults+pad+''+textChildren+pad+'\n'; for (var i = 0; i < numRooms; i++) { x += ''; if (i == 0) { x += renderRoomSelect(); } else { x += ' '; } x += ''; if (numRooms > 1) { x += ''+getValue(textRoomX, i+1)+pad + ''; } x += ''; x += buildSelect('room-' + i + '-adult-total', 'setNumAdults(' + i + ', this.options[this.selectedIndex].value)', 1, 4, adultsPerRoom[i]); x += ''; x += buildSelect('room-' + i + '-child-total', 'setNumChildren(' + i + ', this.options[this.selectedIndex].value)', 0, 6, childrenPerRoom[i]); x += '\n'; } x += '
\n'; var didHeader = false; for (var i = 0; i < numRooms; i++) { if (childrenPerRoom[i] > 0) { if (!didHeader) { x += '\n'; x += ''; x += '
'; x += childHelp; x += '
'; x += '
\n '; for (var j = 0; j < maxChildren; j++) { x += ''+getValue(textChildX, j+1)+pad+'\n'; } didHeader = true; } x += '\n'+getValue(textRoomX, i+1)+pad+''; for (var j = 0; j < childrenPerRoom[i]; j++) { x += ''; var def = -1; if (childAgesPerRoom[i] != null) { if (childAgesPerRoom[i][j] != null) { def = childAgesPerRoom[i][j]; } } x += '\n'; } } if (didHeader) { x += '
\n'; } } document.getElementById("hot-search-params").innerHTML = x; } function buildSelect(name, onchange, min, max, selected) { var x = '