Advertisement
Guest User

Search box code - body

a guest
Jul 28th, 2010
2,202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 25.17 KB | None | 0 0
  1.  <style type="text/css">
  2.     #searchForm {font-size:11px; font-family: Arial, Helvetica,sans-serif;display: block;width: 280px;}
  3. #searchForm input,#searchForm select {background: white ;padding: 1px 2px;font-size:11px; font-family: Arial, Helvetica,sans-serif;color: black;border:black 1px solid;} /* input box inside font color and outside border color */
  4. #searchForm div#hot-search-params {float:left;}
  5. #searchForm div#hot-search-params table {font-size: 11px;background: #ffffff; border: 0px white solid;}
  6. #searchForm form,#searchForm img {margin: 0;padding:0;border:0;}
  7. #searchForm a:link,#searchForm a:active,#searchForm a:visited,#searchForm a:hover {}
  8. .clearFix:after{content: ".";display: block;height: 0;clear: both;visibility: hidden;}
  9. .clearFix {display: inline-block;background: #ffffff; border: 0px white solid;background: #ffffff; border: 0px white solid;}
  10.     * html .clearFix {height: 1%;background: #ffffff; border: 0px white solid;}
  11. .clearFix {display: block;background: #ffffff; border: 0px white solid;}
  12. #searchForm .outsideBorder {background:#076dae;padding: 10px;}
  13. #searchForm .insideBorder {background: #ffffff; border: 0px white solid; padding: 5px;margin: 0 0 8px 0;}
  14. #searchForm .insideBorder table {float:left;background:#ffffff;}
  15. #searchForm table#nav {margin:0;padding:0;border:0;border-collapse:collapse;}
  16. #searchForm table#nav td {background:#ffffff ; border-top:white 0px solid;border-left:white 0px solid;border-right:#ffffff 0px solid;padding: 5px 3px; margin: 5px 0 0 0;text-align: center;font-size: 11px;}
  17. #searchForm table#nav td.selected {background:#ffffff ;padding: 5px 10px; margin: 0 3px 0 0; color: #ffffff;font-size: 11px;border-color: #ffffff;} /*change bg color*/
  18. #searchForm table#nav td a {color:black;text-decoration:none;background:#ffffff;border-color: #ffffff;}
  19. #searchForm table#nav td a:hover {text-decoration:underline;background:#ffffff;border-color: #ffffff;}
  20. #searchForm table {margin: 0;padding: 0;border-collapse: collapse;width: 98%; background:#ffffff; border:0; border-color: #ffffff;}
  21. #searchForm table div#hot-search-params table td {padding:0 7px 2px 0;font-size:11px;background:#ffffff; border:#ffffff;}
  22. #searchForm fieldset {margin: 0;padding: 0;border: 0;}
  23. #searchForm fieldset.date {float:left;padding-right: 10px;width:200px;}
  24. #searchForm fieldset.date img {margin-top: 3px;}
  25. #searchForm p.masterHEADER { color:black; font-weight: bold; font-size: 12px;margin:0 0 10px 0;padding;text-align:left;}
  26. #searchForm .button {color: white;border: black 1px solid;cursor:hand;background:#076dae;text-decoration:none;padding: 3px 5px;margin: 0;float: right;} /* search button text, border and background*/
  27. #searchForm div.cityList {}
  28. #searchForm div.cityList ul {float: left;width: 30%;margin: 0;padding:0}
  29. #searchForm div.cityList ul li {list-style-type:none;margin:0;padding:0}
  30. #searchForm div.cityList ul li.cityBold {font-weight:bold;}
  31. #searchForm div.cityList ul li input, #searchform input#radCityText {border: none;}
  32.     </style>
  33.  
  34.     <div id="searchForm">
  35.  
  36.     <form id="hotSearch" name="hotSearch" action="http://travel.ian.com/index.jsp" method="post" onSubmit="return validate(this);">
  37.  
  38.     <input type="hidden" name="pageName" value="hotSearch">
  39.     <input type="hidden" name="validateDates" value="true">
  40.     <input type="hidden" name="validateCity" value="true">
  41.     <input type="hidden" name="mode" value="2">
  42.     <input type="hidden" name="submitted" value="true">
  43.     <input type="hidden" name="netOnly" value="true">
  44.     <input type="hidden" name="fc" value="list">
  45.     <input type="hidden" name="locale" value="">
  46.  
  47.     <input type="hidden" name="specials" value="false">
  48.     <input type="hidden" name="city" value="">
  49.     <input type="hidden" name="stateProvince" value="">
  50.     <input type="hidden" name="country" value="">
  51.     <input type="hidden" name="showPopUp" value="true">
  52.     <input type="hidden" name="passThrough" value="true">
  53. <input type="hidden" name="cid" value="310453">
  54.  
  55.  
  56.     <div class="outsideBorder clearFix">
  57.  
  58.     <div class="insideBorder">
  59.     <p class="masterHEADER">1. Select a Destination</p>
  60.  
  61.     <div>
  62.  
  63.  
  64.  
  65.     <fieldset class="city">
  66.     <label for="city">City<br /><input name="cityText" class="city" value="<?php if(is_null(get_post_custom_values('city22'))){echo "Enter City Name";} else {
  67. $city22_values = get_post_custom_values('city22');
  68. foreach ( $city22_values as $key => $value ) {
  69.     echo "$value";   };}
  70. ?>
  71. "></label>
  72.  
  73.  
  74.                
  75.  
  76.  
  77.  
  78.  
  79. </div>
  80. </div><!-- end insideBorder -->
  81.  
  82. <div class="insideBorder">
  83. <p class="masterHEADER">2. Select your Dates</p>
  84.  
  85. <div>
  86.  
  87. <fieldset>
  88. <label>Check in<br />
  89.  
  90. <select onchange="amadChange(document.hotSearch.arrivalMonth, document.hotSearch.arrivalDay, document.hotSearch.departureMonth, document.hotSearch.departureDay)" name="arrivalMonth">
  91.  
  92.  
  93. <option value=0>January</option>
  94. <option value=1>February</option>
  95. <option value=2>March</option>
  96. <option value=3>April</option>
  97. <option value=4>May</option>
  98. <option value=5>June</option>
  99. <option value=6>July</option>
  100. <option value=7>August</option>
  101. <option value=8>September</option>
  102. <option value=9>October</option>
  103. <option value=10>November</option>
  104. <option value=11>December</option>
  105.  
  106.  
  107. </select>
  108.  
  109. <select onChange="amadChange(document.hotSearch.arrivalMonth, document.hotSearch.arrivalDay, document.hotSearch.departureMonth, document.hotSearch.departureDay)" name="arrivalDay">
  110. <option value="1">1</option>
  111. <option value="2">2</option>
  112. <option value="3">3</option>
  113. <option value="4">4</option>
  114. <option value="5">5</option>
  115. <option value="6">6</option>
  116. <option value="7">7</option>
  117. <option value="8">8</option>
  118. <option value="9">9</option>
  119. <option value="10">10</option>
  120. <option value="11">11</option>
  121. <option value="12">12</option>
  122. <option value="13">13</option>
  123. <option value="14">14</option>
  124. <option value="15">15</option>
  125. <option value="16">16</option>
  126. <option value="17">17</option>
  127. <option value="18">18</option>
  128. <option value="19">19</option>
  129. <option value="20">20</option>
  130. <option value="21">21</option>
  131. <option value="22">22</option>
  132. <option value="23">23</option>
  133. <option value="24">24</option>
  134. <option value="25">25</option>
  135. <option value="26">26</option>
  136. <option value="27">27</option>
  137. <option value="28">28</option>
  138. <option value="29">29</option>
  139. <option value="30">30</option>
  140. <option value="31">31</option>
  141. </select>
  142.  
  143. <a href="javascript:openCalendar('hotSearch', 'arrival');"><img src="http://travel.ian.com/BU40/_media/icons/calendar.gif" align="bottom"></a>
  144. </label>
  145. </fieldset>
  146.  
  147. <fieldset>
  148. <label>Check out<br />
  149.  
  150. <select onchange="dmddChange(document.hotSearch.departureMonth,document.hotSearch.departureDay)" name="departureMonth">
  151.  
  152.  
  153. <option value=0>January</option>
  154. <option value=1>February</option>
  155. <option value=2>March</option>
  156. <option value=3>April</option>
  157. <option value=4>May</option>
  158. <option value=5>June</option>
  159. <option value=6>July</option>
  160. <option value=7>August</option>
  161. <option value=8>September</option>
  162. <option value=9>October</option>
  163. <option value=10>November</option>
  164. <option value=11>December</option>
  165.  
  166.  
  167. </select>
  168.  
  169. <select onchange="dmddChange(document.hotSearch.departureMonth,document.hotSearch.departureDay)" name="departureDay">
  170. <option value="1">1</option>
  171. <option value="2">2</option>
  172. <option value="3">3</option>
  173. <option value="4">4</option>
  174. <option value="5">5</option>
  175. <option value="6">6</option>
  176. <option value="7">7</option>
  177. <option value="8">8</option>
  178. <option value="9">9</option>
  179. <option value="10">10</option>
  180. <option value="11">11</option>
  181. <option value="12">12</option>
  182. <option value="13">13</option>
  183. <option value="14">14</option>
  184. <option value="15">15</option>
  185. <option value="16">16</option>
  186. <option value="17">17</option>
  187. <option value="18">18</option>
  188. <option value="19">19</option>
  189. <option value="20">20</option>
  190. <option value="21">21</option>
  191. <option value="22">22</option>
  192. <option value="23">23</option>
  193. <option value="24">24</option>
  194. <option value="25">25</option>
  195. <option value="26">26</option>
  196. <option value="27">27</option>
  197. <option value="28">28</option>
  198. <option value="29">29</option>
  199. <option value="30">30</option>
  200. <option value="31">31</option>
  201. </select>
  202.  
  203. </select>
  204. <a href="javascript:openCalendar('hotSearch', 'departure');"><img src="http://travel.ian.com/BU40/_media/icons/calendar.gif" align="bottom"></a>
  205. </label><br>
  206.                    
  207.                    
  208.                    
  209. </fieldset>
  210. <p>
  211. <fieldset>
  212. <table align="left" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" >
  213. <tr bgcolor="#ffffff">
  214. <td><div id="hot-search-params" style="background-color:white;"></div></td>
  215. </tr>
  216. <tr bgcolor="#ffffff">
  217. <td valign="bottom"><input type="submit" value="Search" class="button"></td>
  218. </tr>
  219. </table>
  220. </fieldset>
  221. </div>
  222. </div><!-- end insideBorder -->
  223.  
  224.        
  225. </div><!-- end outsideBorder -->
  226. </form>
  227. </div>
  228. <!-- END SEARCH  -->
  229. <script langage="javascript">
  230. <!--
  231. //start new script code
  232. // Checks if browser is Netscape 2.0x since the options array properties don't work with Netscape 2.0x
  233. function isBrowserSupp() {
  234. // Get the version of the browser
  235. version =  parseFloat( navigator.appVersion );
  236.  
  237. if ( ( version >= 2.0 ) && ( version < 2.1 ) && ( navigator.appName.indexOf( "Netscape" ) != -1 ) ) {
  238.     return false;
  239. } else {
  240.     return true;
  241. }
  242. return true;
  243. }
  244. function isLeapYear( yrStr ) {
  245. var leapYear = false;
  246. var year = parseInt( yrStr, 10 );
  247. // every fourth year is a leap year
  248. if ( year % 4 == 0 ) {
  249.     leapYear = true;
  250.     // unless it's a multiple of 100
  251.     if( year % 100 == 0 ) {
  252.         leapYear = false;
  253.         // unless it's a multiple of 400
  254.         if( year % 400 == 0 ) {
  255.             leapYear=true;
  256.         }
  257.     }
  258. }
  259. return leapYear;
  260. }
  261. function getDaysInMonth( mthIdx, YrStr ) {
  262. // all the rest have 31
  263. var maxDays = 31
  264. // expect Feb. (of course)
  265. if( mthIdx == 1 ) {
  266.     if( isLeapYear( YrStr ) ) {
  267.         maxDays=29;
  268.     } else {
  269.         maxDays=28;
  270.     }
  271. }
  272. // thirty days hath...
  273. if( mthIdx == 3 || mthIdx == 5 || mthIdx == 8 || mthIdx == 10 ) {
  274.     maxDays=30;
  275. }
  276. return maxDays;
  277. }
  278. //the function which does some magic to the date fields
  279. // return non-zero if it is the last day of the month
  280. function adjustDate( mthIdx, Dt ) {
  281. var value = 0;
  282.  
  283. var today = new Date()
  284. var theYear = parseInt( today.getFullYear(), 10 )
  285.  
  286. if( mthIdx < today.getMonth() ) {
  287.     theYear = ( parseInt( today.getFullYear(), 10 ) + 1 )
  288. }
  289. if( theYear < 100 ) {
  290.     theYear = "19" + theYear
  291. } else {
  292.     if( ( theYear - 100 ) < 10 ) {
  293.         theYear = "0" + ( theYear - 100 )
  294.     } else {
  295.         theYear = ( theYear - 100 ) + ""
  296.     }
  297.     theYear = "20" + theYear
  298. }
  299. var numDays = getDaysInMonth( mthIdx, theYear );
  300.  
  301. if( mthIdx == 1 ) {
  302.     if( Dt.options.selectedIndex + 1 < numDays ) {
  303.         return 0;
  304.     } else {
  305.         Dt.options.selectedIndex=numDays - 1;
  306.         //check for leap year
  307.         if( numDays == 29 ) {
  308.             return 99;
  309.         } else {
  310.             return 1;
  311.         }
  312.     }
  313. }
  314.  
  315. if( Dt.options.selectedIndex + 1 < numDays ) {
  316.     value = 0;
  317. } else {
  318.     if ( Dt.options.selectedIndex + 1 > numDays ) {
  319.         Dt.options.selectedIndex--;
  320.         value = 3;
  321.     } else {
  322.         //index is 31 or 30
  323.         value = 2;
  324.     }
  325. }
  326. return value;
  327. }
  328.  
  329. //changes departure month when arrival month is changed
  330. function amadChange( inM, inD, outM, outD ) {
  331. if ( !isBrowserSupp() ) {
  332.     return;
  333. }
  334.  
  335. var res = adjustDate( inM.options.selectedIndex, inD );
  336. if( res != 0 ) {
  337.     outD.options.selectedIndex = 0;
  338.     if ( outM.options.selectedIndex == 11 ) {
  339.         outM.options.selectedIndex = 0
  340.     } else {
  341.         outM.options.selectedIndex=inM.options.selectedIndex + 1;
  342.         outD.options.selectedIndex = 1;
  343.     }
  344. } else {
  345.     outM.options.selectedIndex = inM.options.selectedIndex;
  346.     if (outD.options.selectedIndex <= inD.options.selectedIndex) {
  347.         outD.options.selectedIndex = inD.options.selectedIndex + 2;
  348.     }
  349. }
  350. return;
  351. }
  352.  
  353.  
  354.  
  355.  
  356. function dmddChange( outM, outD ) {
  357. if ( !isBrowserSupp() ) {
  358.     return;
  359. }
  360.  
  361. adjustDate( outM.options.selectedIndex, outD );
  362. return;
  363. }
  364.  
  365.  
  366.  
  367.  
  368. function loadDates(arrivalMonthSelect,  arrivalDaySelect, departureMonthSelect, departureDaySelect)
  369. {
  370. var calendar = new Date();
  371. var calendar2 = new Date();
  372. var cal
  373. var cal2
  374. var date;
  375. var month;
  376. var year;
  377. var date2;
  378. var month2;
  379. var year2;
  380.  
  381. //Here is the variable to change for to advance the arrival Date
  382. var advanceArrival = 14;
  383. //Here is the variable to change for to advance the departure Date
  384. var advanceDeparture = 16;
  385.  
  386.  
  387. //Set the arrival Days
  388. calendar.setDate(calendar.getDate()+ advanceArrival);
  389. date = calendar.getDate();
  390. month = calendar.getMonth();
  391.  
  392. //Set the Departure Days
  393. calendar2.setDate(calendar2.getDate()+advanceDeparture);
  394. date2 = calendar2.getDate();
  395. month2 = calendar2.getMonth();
  396.  
  397. arrivalMonthSelect.value=month;
  398. arrivalDaySelect.value=date;
  399. departureMonthSelect.value=month2;
  400. departureDaySelect.value=date2;
  401. }
  402. //-->
  403. </script>
  404.  
  405. <script langauage="javascript">
  406. <!--
  407. function update(themonth,theday){
  408. document.forms[fName].elements[formType+'Day'].options[theday - 1].selected = true;
  409. document.forms[fName].elements[formType+'Month'].options[themonth].selected = true;
  410.  
  411. testWindow.close();
  412. }
  413. function loadCalendar(viewMonth) {
  414. testWindow.document.close();
  415. testWindow.document.open();
  416.  
  417. var day_of_week = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
  418. var month_of_year = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
  419.  
  420. var dateObj = new Date();
  421. var year = dateObj.getFullYear();    // Returns year
  422. var month = dateObj.getMonth();  // Returns month (0-11)
  423. var today = dateObj.getDate();   // Returns day (1-31)
  424. var weekday = dateObj.getDay();  // Returns day (1-31)
  425.  
  426. var DAYS_OF_WEEK = 7;   // "constant" for number of days in a week
  427. var DAYS_OF_MONTH = 31; // "constant" for number of days in a month
  428. var cal;                // Used for printing
  429.  
  430. if (viewMonth < month) {
  431.     year = year + 1;
  432. }
  433.  
  434. if(year < 1900){
  435.     year += 1900; //done to solve the problem of netscape and mozilla returning year in form 10X for years > 2000
  436. }
  437.  
  438. month = viewMonth;
  439. dateObj.setDate(1);      // Start the calendar day at '1'
  440. dateObj.setMonth(month); // Start the calendar month at now
  441. dateObj.setFullYear((year));
  442.  
  443. // VARIABLES FOR FORMATTING
  444. var TR_start = '<TR>';
  445. var TR_end = '</TR>';
  446. var highlight_start = '<TD WIDTH="30"><TABLE CELLSPACING=0 BORDER=0 BORDERCOLOR=CCCCCC><TR><TD WIDTH=20><B><CENTER>';
  447. var highlight_end   = '</CENTER></TD></TR></TABLE></B>';
  448. var TD_start = '<TD WIDTH="30"><CENTER>';
  449. var TD_end = '</CENTER></TD>';
  450. var prevM = month - 1;
  451. var nextM = month + 1;
  452.  
  453. if (nextM == 12) {
  454.     nextM = 0;
  455. }
  456.  
  457. if (prevM == -1) {
  458.     prevM = 11;
  459. }
  460.  
  461. // BEGIN CODE FOR CALENDAR
  462. cal =  '<html><head><title>Calendar</title></head><body>';
  463. cal += '<style>a{cursor: hand}body,table,td{cursor: default;font-family:sans-serif;font-size:12px;color:black;}p.masterHEADER {background: gray; color:white; font-weight: bold; font-size: 13px;margin:0;padding:5px;text-align: center;}</style>';
  464.  
  465. cal += '<div style="border:black 1px solid;">';
  466. cal += '<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="2" width="100%">' + TR_start;
  467. cal += '<TD COLSPAN="' + DAYS_OF_WEEK + '"><p class=masterHEADER>';
  468. cal += month_of_year[month] + '   ' + year + '</p>' + TD_end + TR_end;
  469. cal += TR_start;
  470.  
  471. ///////////////////////////////////
  472. // DO NOT EDIT BELOW THIS POINT  //
  473. ///////////////////////////////////
  474.  
  475. // LOOPS FOR EACH DAY OF WEEK
  476. for(index=0; index < DAYS_OF_WEEK; index++) {
  477.     // PRINTS DAY
  478.     cal += TD_start + day_of_week[index] + TD_end;
  479. }
  480.  
  481. cal += TD_end + TR_end;
  482. cal += TR_start;
  483.  
  484. // FILL IN BLANK GAPS UNTIL TODAY'S DAY
  485. for(index=0; index < dateObj.getDay(); index++) {
  486.     cal += TD_start + '  ' + TD_end;
  487. }
  488.  
  489. // LOOPS FOR EACH DAY IN CALENDAR
  490. for(index=0; index < DAYS_OF_MONTH; index++) {
  491.     if( dateObj.getDate() > index ) {
  492.         // RETURNS THE NEXT DAY TO PRINT
  493.         week_day =dateObj.getDay();
  494.  
  495.         // START NEW ROW FOR FIRST DAY OF WEEK
  496.         if(week_day == 0) {
  497.             cal += TR_start;
  498.         }
  499.  
  500.         if(week_day != DAYS_OF_WEEK) {
  501.             // SET VARIABLE INSIDE LOOP FOR INCREMENTING PURPOSES
  502.             var day  = dateObj.getDate();
  503.  
  504.             // PRINTS DAY
  505.             cal += TD_start + "<span onclick='window.opener.update(" + month + "," + day + "," + year +")'>" + day + "</span>" + TD_end;
  506.         }
  507.  
  508.         // END ROW FOR LAST DAY OF WEEK
  509.         if(week_day == DAYS_OF_WEEK) {
  510.             cal += TR_end;
  511.         }
  512.     }
  513.  
  514.     // INCREMENTS UNTIL END OF THE MONTH
  515.     dateObj.setDate(dateObj.getDate()+1);
  516.  
  517. }// end for loop
  518.  
  519. cal += '</td></TR></TABLE></div><br>';
  520. cal += '<div align="center"><a href="javascript:" onClick="window.opener.loadCalendar(' + prevM + ');">&lt;&lt;</a>&nbsp;&nbsp;&nbsp;&nbsp;';
  521. cal += '<a href="javascript:" onClick="window.opener.loadCalendar(' + nextM + ');">&gt;&gt;</a></div>';
  522. cal += '<a href="javascript:window.close();" style="float:right">close</a>';
  523. cal += '</body></html>';
  524.  
  525. //  PRINT CALENDAR
  526. testWindow.document.write(cal);
  527. }
  528.  
  529. var testWindow;
  530. var fieldName;
  531. var fName;
  532.  
  533. function openCalendar(formName,type) {
  534. formType=type;
  535. fName=formName;
  536. testWindow = window.open('','dates','width=300,height=225,resizable=1,status=1,menubar=0,location=0');
  537. loadCalendar(document.forms[fName].elements[formType+'Month'].selectedIndex);
  538. }
  539. //-->
  540. </script>
  541. <script language="javascript">
  542. <!--
  543. function setCityInformation(_city, _state, _country) {
  544. clearTextBox(document.forms["hotSearch"].cityText);
  545. document.forms["hotSearch"].city.value = _city;
  546. document.forms["hotSearch"].stateProvince.value = _state;
  547. document.forms["hotSearch"].country.value = _country;
  548. }
  549.  
  550. function clearTextBox(_textbox) {
  551. _textbox.value = "";
  552. }
  553.  
  554. function validate(form) {
  555. if (form.numberOfRooms.selectedIndex == 8) {
  556.     window.location = "http://travel.ian.com/index.jsp?pageName=groups&cid="&document.forms["hotsearch"].cid.value&"locale=en_US";
  557.     return false;
  558. }
  559.  
  560. if (document.forms["hotSearch"].cityText.value != "") {
  561.     document.forms["hotSearch"].stateProvince.value = "";
  562.     document.forms["hotSearch"].country.value = "";
  563.     document.forms["hotSearch"].city.value = document.forms["hotSearch"].cityText.value;
  564. }
  565.  
  566. return submitGuestInfoForm(form);
  567. }
  568. //-->
  569. </script>
  570. <!-- my custom search box -->
  571. <script language="javascript">
  572. <!--
  573. // NOTE: customize variables in this javascript block as appropriate.
  574. var defaultAdults="2";
  575. var cellStyle="";
  576. var childHelp="<p style=font-size:11px;>Please provide the ages of children in each room. Children's ages should be their age at the time of travel.</p>";
  577. var adultHelp="";
  578. var textRooms="Rooms";
  579. var textAdults="Adults <br> (age 19+)";
  580. var textChildren="Children";
  581. var textChildError="Please specify the ages of all children.";
  582. var pad='<img src="http://travel.ian.com/images/p.gif" width="5" height="1">';
  583. // NOTE: Question marks ("?") get replaced with a numeric value
  584. var textRoomX="Room ?:";
  585. var textChildX="Child ?:";
  586.  
  587. //-->
  588. </script>
  589. <!-- NOTE: DO NOT MODIFY THIS JAVASCRIPT BLOCK -->
  590. <script language="javascript">
  591. <!--
  592. var adultsPerRoom=new Array(defaultAdults);
  593. var childrenPerRoom=new Array();
  594. var childAgesPerRoom=new Array();
  595. var numRooms=1;
  596. var maxChildren=0;
  597.  
  598. refresh();
  599.  
  600. function setChildAge(room, child, age) {
  601. if (childAgesPerRoom[room] == null) {
  602.     childAgesPerRoom[room] = new Array();
  603. }
  604. childAgesPerRoom[room][child] = age;
  605. }
  606.  
  607. function setNumAdults(room, numAdults) {
  608. adultsPerRoom[room] = numAdults;
  609. }
  610.  
  611. function setNumChildren(room, numChildren) {
  612. childrenPerRoom[room] = numChildren;
  613. refresh();
  614. }
  615.  
  616. function setNumRooms(x) {
  617. numRooms = x;
  618. for (i = 0; i < x; i++) {
  619.     if (adultsPerRoom[i] == null) {
  620.         adultsPerRoom[i] = 2;
  621.     }
  622.     if (childrenPerRoom[i] == null) {
  623.         childrenPerRoom[i] = 0;
  624.     }
  625. }
  626. refresh();
  627. }
  628.  
  629. function renderRoomSelect() {
  630. var x = '';
  631. x += '<select name="numberOfRooms" onchange="setNumRooms(this.options[this.selectedIndex].value);">';
  632. for (var i = 1; i < 9; i++) {
  633.     x += '<option value="'+i+'"'+(numRooms == i ? ' selected' : '')+'>' + i;
  634. }
  635. x += '<option value="9"'+(numRooms == 9 ? ' selected' : '')+'>9+';
  636. x += '</select>';
  637. return x;
  638. }
  639.  
  640. function refresh() {
  641. maxChildren = 0;
  642. for (var i = 0; i < numRooms; i++) {
  643.     if (childrenPerRoom[i] > maxChildren) {
  644.         maxChildren = childrenPerRoom[i];
  645.     }
  646. }
  647.  
  648. var x = '';
  649. if (adultHelp.length > 0) {
  650.     x = adultHelp + "<p>\n";
  651. }
  652.  
  653. if (numRooms > 8) {
  654.     x += textRooms;
  655.     x += renderRoomSelect();
  656.  
  657. } else {
  658.     x += '<table border="0" cellspacing="2" cellpadding="0" bgcolor=#fffff>\n';
  659.     x += '<tr><td'+cellStyle+'>'+textRooms+pad+'</td>';
  660.     if (numRooms >= 1) {
  661.         x += '<td'+cellStyle+'>&nbsp;</td>';
  662.     }
  663.     x += '<td'+cellStyle+'><nobr>'+textAdults+pad+'</nobr></td><td'+cellStyle+'><nobr>'+textChildren+pad+'</nobr></td></tr>\n';
  664.     for (var i = 0; i < numRooms; i++) {
  665.         x += '<tr><td'+cellStyle+'>';
  666.         if (i == 0) {
  667.             x += renderRoomSelect();
  668.         } else {
  669.             x += '&nbsp;';
  670.         }
  671.         x += '</td>';
  672.         if (numRooms >= 1) {
  673.             x += '<td'+cellStyle+'><nobr>'+getValue(textRoomX, i+1)+pad + '</nobr></td>';
  674.         }
  675.         x += '<td'+cellStyle+'>';
  676.         x += buildSelect('room-' + i + '-adult-total', 'setNumAdults(' + i + ', this.options[this.selectedIndex].value)', 1, 4, adultsPerRoom[i]);
  677.         x += '</td><td'+cellStyle+'>';
  678.         x += buildSelect('room-' + i + '-child-total', 'setNumChildren(' + i + ', this.options[this.selectedIndex].value)', 0, 5, childrenPerRoom[i]);
  679.         x += '</td></tr>\n';
  680.     }
  681.     x += '</table>\n';
  682.  
  683.     var didHeader = false;
  684.     for (var i = 0; i < numRooms; i++) {
  685.         if (childrenPerRoom[i] > 0) {
  686.             if (!didHeader) {
  687.                 x += '<table border="0" cellpadding="0" cellspacing="2" bgcolor=#fffff>\n';
  688.                 x += '<tr><td'+cellStyle+' colspan="'+(maxChildren+1)+'">';
  689.                 x += '<img src="/images/p.gif" width="1" height="5"><br>';
  690.                 x += childHelp;
  691.                 x += '<img src="/images/p.gif" width="1" height="5"><br>';
  692.                 x += '</td></tr>\n<tr><td'+cellStyle+'>&nbsp;</td>';
  693.                 for (var j = 0; j < maxChildren; j++) {
  694.                     x += '<td'+cellStyle+'><nobr>'+getValue(textChildX, j+1)+pad+'</nobr></td>\n';
  695.                 }
  696.                 didHeader = true;
  697.             }
  698.             x += '</tr>\n<tr><td'+cellStyle+'><nobr>'+getValue(textRoomX, i+1)+pad+'</nobr></td>';
  699.             for (var j = 0; j < childrenPerRoom[i]; j++) {
  700.                 x += '<td'+cellStyle+'>';
  701.                 var def = -1;
  702.                 if (childAgesPerRoom[i] != null) {
  703.                     if (childAgesPerRoom[i][j] != null) {
  704.                         def = childAgesPerRoom[i][j];
  705.                     }
  706.                 }
  707.                 x += '<select name="room-'+i+'-child-'+j+'-age" onchange="setChildAge('+i+', '+j+', this.options[this.selectedIndex].value);">';
  708.                 x += '<option value="-1"'+(def == -1 ? ' selected' : '')+'>-?-';
  709.                 x += '<option value="0"'+(def == 0 ? ' selected' : '')+'>&lt;1';
  710.                 for (var k = 1; k <= 18; k++) {
  711.                     x += '<option value="'+k+'"'+(def == k ? ' selected' : '')+'>'+k;
  712.                 }
  713.                 x += '</td>';
  714.             }
  715.             if (childrenPerRoom[i] < maxChildren) {
  716.                 for (var j = childrenPerRoom[i]; j < maxChildren; j++) {
  717.                     x += '<td'+cellStyle+'>&nbsp;</td>';
  718.                 }
  719.             }
  720.             x += '</tr>\n';
  721.         }
  722.     }
  723.     if (didHeader) {
  724.         x += '</table>\n';
  725.     }
  726. }
  727.  
  728. document.getElementById("hot-search-params").innerHTML = x;
  729. }
  730.  
  731. function buildSelect(name, onchange, min, max, selected) {
  732. var x = '<select name="' + name + '"';
  733. if (onchange != null) {
  734.     x += ' onchange="' + onchange + '"';
  735. }
  736. x +='>\n';
  737. for (var i = min; i <= max; i++) {
  738.     x += '<option value="' + i + '"';
  739.     if (i == selected) {
  740.         x += ' selected';
  741.     }
  742.  
  743.     x += '>' + i + '\n';
  744. }
  745. x += '</select>';
  746. return x;
  747. }
  748.  
  749. function validateGuests(form) {
  750. if (numRooms < 9) {
  751.     var missingAge = false;
  752.     for (var i = 0; i < numRooms; i++) {
  753.         var numChildren = childrenPerRoom[i];
  754.         if (numChildren != null && numChildren > 0) {
  755.             for (var j = 0; j < numChildren; j++) {
  756.                 if (childAgesPerRoom[i] == null || childAgesPerRoom[i][j] == null || childAgesPerRoom[i][j] == -1) {
  757.                     missingAge = true;
  758.                 }
  759.             }
  760.         }
  761.     }
  762.  
  763.     if (missingAge) {
  764.         alert(textChildError);
  765.         return false;
  766.     } else {
  767.         return true;
  768.     }
  769. } else {
  770.     return true;
  771. }
  772. }
  773.  
  774. function submitGuestInfoForm(form) {
  775. if (!validateGuests(form)) {
  776.     return false;
  777. }
  778.  
  779. return true;
  780. }
  781.  
  782. function getValue(str, val) {
  783. return str.replace(/\?/g, val);
  784. }
  785. //-->
  786. </script>
  787.  
  788. <script defer="defer" type="text/javascript">
  789. loadDates(document.forms['hotSearch'].arrivalMonth,document.forms['hotSearch'].arrivalDay, document.forms['hotSearch'].departureMonth, document.forms['hotSearch'].departureDay)
  790. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement