var num_RoomsRequired;var obj_Occupancy;var obj_ChildAges;var minStringLen=2;var lastSearch="";var directionActive="";var currentSearch=0;function js_DOMCreateDiv(C,A,B){el_NewDiv=document.createElement("div");if(C.length>0){el_NewDiv.className=C}if(A!=""){el_NewText=document.createTextNode(A);el_NewDiv.appendChild(el_NewText)}if(B){el_NewDiv.appendChild(B)}return el_NewDiv}function js_DOMCreateP(C,A,B){el_NewDiv=document.createElement("P");if(C.len>0){if(navigator.userAgent.indexOf("MSIE")==-1){el_NewDiv.setAttribute("class",C)}else{el_NewDiv.setAttribute("className",C)}}if(A!=""){el_NewText=document.createTextNode(A);el_NewDiv.appendChild(el_NewText)}if(B){el_NewDiv.appendChild(B)}return el_NewDiv}function js_checkChildAgesFilled(A){while(A.tagName!=="FORM"){A=A.parentNode}rExp=/frm_Child[0-9]/gi;allSet=true;if(A.elements.length>0){for(i=0;i<A.elements.length;i++){if(A.elements[i].id.search(rExp)>-1&&A.elements[i].options[A.elements[i].selectedIndex].value==-1){allSet=false}}}return allSet}function js_DOMCreateSelect(B,C,A,D){if(D===undefined){D=""}el_NewSelect=document.createElement("SELECT");el_NewSelect.setAttribute("name",B);el_NewSelect.setAttribute("id",D+B);rExp=/frm_Child[0-9]/gi;if(B.search(rExp)>-1){js_addOption(el_NewSelect,"-1","-",false);if(document.getElementById("holSearchSubmit")){el_NewSelect.onchange=function(){js_checkChildAgesFilled(this)}}}rExp=/frm_AdultsRoom[0-9]/gi;for(j=C;j<=A;j++){if((B.search(rExp)>-1)&&(j==2)){js_addOption(el_NewSelect,j,j,true)}else{js_addOption(el_NewSelect,j,j,false)}}return el_NewSelect}function js_SelectRoomOccupants(A,C){for(rl=0;rl<A;rl++){num_RoomNum=rl+1;var B=parseInt(obj_Occupancy.occupancy[rl]["num_numchildren"])+parseInt(obj_Occupancy.occupancy[rl]["num_numinfants"]);js_selectValue("frm_AdultsRoom"+(num_RoomNum),obj_Occupancy.occupancy[rl]["num_numadults"],false);js_selectValue("frm_ChildrenRoom"+(num_RoomNum),B,false)}}function js_SelectChildAges(B){B=B||"";var A=0;for(i=1;i<=num_RoomsRequired;i++){A=A+parseInt($(B+"frm_ChildrenRoom"+i).value)}for(ch=1;ch<=A;ch++){js_selectValue(B+"frm_Child"+(ch),arr_ChildAges[ch-1],false)}}function js_addOption(A,C,B,E){var D=document.createElement("OPTION");D.value=C;D.text=B;if(E){D.selected="selected"}if(navigator.userAgent.indexOf("MSIE")==-1){A.add(D,null)}else{A.add(D)}}function js_selectValue(D,E,A){var C=$(D);if(C){var B=C.childNodes.length;if(B!=0){for(i=0;i<B;i++){if(C.childNodes[i].value==E){C.childNodes[i].selected=true;if(A){C.onchange()}return true}}}}}function js_removeFirstChild(A){A.removeChild(A.firstChild)}function js_removeAllChildren(A){if(A!==null&&A.firstChild){while(A.firstChild){A.removeChild(A.firstChild)}}}function initHolidaySearchForm(B){if(B===undefined){B=""}if(B.length===undefined){B=""}for(i=1;i<10;i++){if($(B+"JSonly_"+i)){$(B+"JSonly_"+i).style.display="block"}else{break}}for(i=1;i<10;i++){if($(B+"JSonlyrow_"+i)){try{$(B+"JSonlyrow_"+i).style.display="table-row"}catch(A){$(B+"JSonlyrow_"+i).style.display="block"}}else{break}}try{$(B+"cal1input").style.backgroundImage="url(/images/icon_calendar.gif)"}catch(A){}try{$(B+"cal2input").style.backgroundImage="url(/images/icon_calendar.gif)"}catch(A){}try{$(B+"cal3input").style.backgroundImage="url(/images/icon_calendar.gif)"}catch(A){}try{$(B+"cal4input").style.backgroundImage="url(/images/icon_calendar.gif)"}catch(A){}if($(B+"hs_ChildAges")){$(B+"hs_ChildAges").style.display="block"}js_OutputRoomOccupants(num_RoomsRequired,B);js_selectValue(B+"frm_AdultsRoom1",2,false);if(obj_Occupancy!==undefined){js_SelectRoomOccupants(num_RoomsRequired,B)}js_OutputChildAges(B);js_SelectChildAges(B);try{toggle_advSearch()}catch(A){}}function js_OutputRoomOccupants(A,E){if(E===undefined){E=""}var C="";var B="";obj_Occupants=$(E+"hs_Occupants");num_RoomsRequired=A;js_removeAllChildren(obj_Occupants);for(i=1;i<=A;i++){obj_AdultsSelect=js_DOMCreateSelect("frm_AdultsRoom"+i,1,9,E);obj_ChildrenSelect=js_DOMCreateSelect("frm_ChildrenRoom"+i,0,9,E);obj_Clear=js_DOMCreateDiv("hs_Clear","");obj_RoomNumber=js_DOMCreateDiv("sb_label","Room "+i);obj_Occupants.appendChild(obj_RoomNumber);obj_selection=js_DOMCreateDiv("sb_selection","");obj_Adults=js_DOMCreateDiv("hs_OccupantsAdults","",obj_AdultsSelect);obj_Children=js_DOMCreateDiv("hs_OccupantsChildren","",obj_ChildrenSelect);if(navigator.userAgent.indexOf("MSIE")==-1){obj_Children.onchange=function(){js_OutputChildAges(E)}}obj_selection.appendChild(obj_Adults);obj_selection.appendChild(obj_Children);obj_Occupants.appendChild(obj_selection);obj_br=document.createElement("br");obj_br.className="c";obj_Occupants.appendChild(obj_br);if(navigator.userAgent.indexOf("MSIE")!=-1){eventAttached=document.getElementById(E+"frm_ChildrenRoom"+i).attachEvent("onchange",function(){js_OutputChildAges(E)})}}try{$(E+"hs_rooms_occ").show()}catch(D){}js_OutputChildAges(E)}function js_OutputChildAges(C){if(C===undefined){C=""}if(Number(C)==C){C=""}obj_ChildAges=$(C+"hs_ChildAges");if(obj_ChildAges!==null){js_removeAllChildren(obj_ChildAges);var A=0;for(i=1;i<=num_RoomsRequired;i++){A=A+parseInt($(C+"frm_ChildrenRoom"+i).value)}if(A!=0){obj_IntroText=js_DOMCreateDiv("hs_ChildIntroText","Please specify the ages of children on the date of return.");obj_ChildAges.appendChild(obj_IntroText);obj_ChildAges.appendChild(obj_Clear);for(i=1;i<=A;i++){obj_ChildAgeSelect=js_DOMCreateSelect("frm_Child"+i,0,17,C);obj_ChildNumber=js_DOMCreateDiv("sb_label","Child "+i);obj_ChildAge=js_DOMCreateDiv("hs_Children","",obj_ChildAgeSelect);obj_Clear=js_DOMCreateDiv("hs_Clear","");obj_ChildAges.appendChild(obj_ChildNumber);obj_ChildAges.appendChild(obj_ChildAge);obj_ChildAges.appendChild(obj_Clear)}obj_ChildAges.style.display="block"}else{obj_ChildAges.style.display="none"}}try{initmargins()}catch(B){}}function toggle_advSearch(){if($("hs_adv_options")){$("hs_adv_options").toggle()}if($("hs_adv_options")&&$("hs_adv_options").style.display=="none"){$("hs_adv_options_a").innerHTML="more search options"}else{$("hs_adv_options_a").innerHTML="less search options"}try{initmargins()}catch(A){}}function js_hideAllPopups(){try{hidePopups()}catch(A){}if($("cal1anchor")){$("cal1anchor").style.display="none"}if($("cal2anchor")){$("cal2anchor").style.display="none"}if($("cal3anchor")){$("cal3anchor").style.display="none"}if($("frm_departure_suggestions")){$("frm_departure_suggestions").style.display="none"}if($("frm_destination_suggestions")){$("frm_destination_suggestions").style.display="none"}if($("hideDiv")){$("hideDiv").style.display="none"}if(navigator.userAgent.match("MSIE 6")){if($("NoA")){$("NoA").style.visibility="visible"}if($("NoC")){$("NoC").style.visibility="visible"}}if($("submitButton")){$("submitButton").disabled=false}}function js_updateNights(C){var A=document.getElementById("cal1input");var B=document.getElementById("cal2input");var D=new Date(A.value.substr(6,4),(A.value.substr(3,2)-1),A.value.substr(0,2));D.setTime(D.getTime()+(C*24*60*60*1000));B.value=lZero(D.getDate(),2)+"/"+lZero(D.getMonth()+1,2)+"/"+lZero(D.getFullYear(),2);DLHNS.calendar.cal2.select((D.getMonth()+1)+"/"+D.getDate()+"/"+D.getFullYear());DLHNS.calendar.cal2.setYear(D.getFullYear());DLHNS.calendar.cal2.setMonth(D.getMonth());DLHNS.calendar.cal2.render()}function js_suggestAirport(F,B){if(B!=lastSearch){directionActive=F;if(B.length>=minStringLen){currentSearch++;lastSearch=B;var A="/flight_search_ajax.cfm";var C="method=suggestAirport&currentSearch="+currentSearch+"&direction="+directionActive+"&searchString="+B;if(directionActive=="destination"&&document.getElementById("frm_departure_point").value!=""){C+="&deptCode="+document.getElementById("frm_departure_point").value}if(directionActive=="departure"&&document.getElementById("frm_destination_point").value!=""){C+="&destCode="+document.getElementById("frm_destination_point").value}var E=new Ajax.Request(A,{method:"get",parameters:C,onComplete:js_updateSuggestionField})}else{js_hideAllPopups();var D=document.getElementById("frm_"+directionActive+"_suggestions");while(D.firstChild){D.removeChild(D.firstChild)}lastSearch=""}}}function js_hideAndSelect(){selIndex=js_findSelectedIndex();if(!isNaN(selIndex)&&directionActive){document.getElementById("frm_"+directionActive+"_suggestions").style.display="none";if(document.getElementById("li_"+directionActive+"_"+selIndex+"_text")){document.getElementById("frm_"+directionActive+"_name").value=document.getElementById("li_"+directionActive+"_"+selIndex+"_text").value;lastSearch=document.getElementById("li_"+directionActive+"_"+selIndex+"_text").value}if(document.getElementById("li_"+directionActive+"_"+selIndex+"_value")){document.getElementById("frm_"+directionActive+"_point").value=document.getElementById("li_"+directionActive+"_"+selIndex+"_value").value}directionActive=""}js_hideAllPopups()}function js_findSelectedIndex(){if(document.getElementById(directionActive+"_ul")){list=document.getElementById(directionActive+"_ul");nChildren=list.childNodes.length;if(nChildren>0){for(i=0;i<nChildren;i++){if(list.childNodes[i]&&list.childNodes[i].className&&list.childNodes[i].className=="frm_suggest_list_hover"){return i}}}}return false}function js_highlightSelection(A){curIndex=js_findSelectedIndex();if(document.getElementById(directionActive+"_ul")&&curIndex!==A){list=document.getElementById(directionActive+"_ul");if(A=="n"||A=="p"){if(A=="n"&&curIndex<list.childNodes.length-1){A=curIndex+1}else{if(A=="p"&&curIndex>0){A=curIndex-1}}}if(!isNaN(A)){list.childNodes[A].className="frm_suggest_list_hover";if(curIndex!==false){list.childNodes[curIndex].className=""}}}}function js_moveSelection(B,A){if(A.id=="hotel_name"){js_moveHotelSelection(B);return }if(!B){B=window.event}if(B.keyCode==38){js_highlightSelection("p")}else{if(B.keyCode==40){js_highlightSelection("n")}else{if(B.keyCode==9||B.keyCode==13){js_hideAndSelect()}else{if((B.keyCode==8||B.keyCode==46)&&document.getElementById("frm_"+directionActive+"_point").value!=""){document.getElementById("frm_"+directionActive+"_point").value="";while(document.getElementById("frm_"+directionActive+"_suggestions").firstChild){document.getElementById("frm_"+directionActive+"_suggestions").removeChild(document.getElementById("frm_"+directionActive+"_suggestions").firstChild)}}}}}}function js_updateSuggestionField(C){var G=C.responseXML;var F=G.getElementsByTagName("r")[0].getAttribute("sid");var B=document.getElementById("frm_"+directionActive+"_name").value;if(F==currentSearch&&B.length>=minStringLen){var E=document.getElementById("frm_"+directionActive+"_suggestions");var D=G.getElementsByTagName("p").length;while(E.firstChild){E.removeChild(E.firstChild)}E.style.display="none";if(D>0){rExp=new RegExp("("+B+")","gi");newUL=document.createElement("ul");newUL.id=directionActive+"_ul";for(var A=0;A<D;A++){airportCode=G.getElementsByTagName("p")[A].getAttribute("v");airportName=G.getElementsByTagName("p")[A].firstChild.data;divText=airportName.replace(rExp,'<span class="selHighlight">$1</span>');newUL.innerHTML+='<li onmouseover="js_highlightSelection('+A+')" onclick="js_hideAndSelect()"><input type="hidden" id="li_'+directionActive+"_"+A+'_value" value="'+airportCode+'" /><input type="hidden" id="li_'+directionActive+"_"+A+'_text" value="'+airportName+'" />'+divText+"</li>"}E.appendChild(newUL);if(navigator.userAgent.match("MSIE 6")){if($("NoA")){$("NoA").style.visibility="hidden"}if($("NoC")){$("NoC").style.visibility="hidden"}}if($("submitButton")){$("submitButton").disabled=true}E.style.display="block";js_highlightSelection(0)}else{E.innerHTML+='<div class="noFFResults"><i>no results found</i></div>';E.style.display="block"}if(document.getElementById("hideDiv")){document.getElementById("hideDiv").style.display="block"}}}function fs_deptClearOnFirstClick(){$("frm_departure_point").value="";$("frm_departure_name").value="";$("frm_departure_name").onclick=js_hideAllPopups;js_hideAllPopups()}function ms_SetSite(A){switch(A){case"DLF":if($("dlh_dayslater")){$("dlh_dayslater").style.display="none"}if($("dlh_dest_point")){$("dlh_dest_point").style.display="none"}if($("dlh_dept_point")){$("dlh_dept_point").style.display="none"}if($("dla_dest_point")){$("dla_dest_point").style.display="none"}if($("hs_dates")){$("hs_dates").style.display="none"}if($("hs_duration")){$("hs_duration").style.display="none"}if($("hs_rooms")){$("hs_rooms").style.display="none"}if($("hs_rooms_occ")){$("hs_rooms_occ").style.display="none"}if($("hs_extras")){$("hs_extras").style.display="none"}if($("hs_extras_switch")){$("hs_extras_switch").style.display="none"}if($("dlf_dest_point")){$("dlf_dest_point").style.display="block"}if($("hs_dept_header")){$("hs_dept_header").style.display="block"}if($("dlf_dept_point")){$("dlf_dept_point").style.display="block"}if($("dlf_dates")){$("dlf_dates").style.display="block"}if($("dlf_rooms")){$("dlf_rooms").style.display="block"}break;case"DLH":if($("dla_dest_point")){$("dla_dest_point").style.display="none"}if($("dlh_dest_point")){$("dlh_dest_point").style.display="block"}if($("hs_dept_header")){$("hs_dept_header").style.display="block"}if($("dlh_dept_point")){$("dlh_dept_point").style.display="block"}if($("dlh_dayslater")){$("dlh_dayslater").style.display="block"}case"DLA":if(A=="DLA"){if($("dlh_dest_point")){$("dlh_dest_point").style.display="none"}if($("hs_dept_header")){$("hs_dept_header").style.display="none"}if($("dlh_dept_point")){$("dlh_dept_point").style.display="none"}if($("dlh_dayslater")){$("dlh_dayslater").style.display="none"}if($("dla_dest_point")){$("dla_dest_point").style.display="block"}}if($("dlf_dest_point")){$("dlf_dest_point").style.display="none"}if($("dlf_dept_point")){$("dlf_dept_point").style.display="none"}if($("dlf_dates")){$("dlf_dates").style.display="none"}if($("dlf_rooms")){$("dlf_rooms").style.display="none"}if($("hs_dates")){$("hs_dates").style.display="block"}if($("hs_duration")){$("hs_duration").style.display="block"}if($("hs_rooms")){$("hs_rooms").style.display="block"}if($("hs_rooms_occ")){$("hs_rooms_occ").style.display="block"}if($("hs_extras")){$("hs_extras").style.display="block"}if($("hs_extras_switch")){$("hs_extras_switch").style.display="block"}break}js_OutputChildAges();js_SelectChildAges()}function js_suggestHotel(B){if(B!=lastSearch){if(B.length>=minStringLen){currentSearch++;lastSearch=B;var A="/hotel_search_ajax.cfm";var C="method=suggestHotel&currentSearch="+currentSearch+"&searchString="+B;var E=new Ajax.Request(A,{method:"get",parameters:C,onComplete:js_updateHotelSuggestionField})}else{js_hideAllPopups();var D=$("hotel_suggestions");while(D.firstChild){D.removeChild(D.firstChild)}lastSearch=""}}}function js_updateHotelSuggestionField(C){var G=C.responseXML;var F=G.getElementsByTagName("r")[0].getAttribute("sid");var B=$("hotel_name").value;if(F==currentSearch&&B.length>=minStringLen){var E=$("hotel_suggestions");var D=G.getElementsByTagName("p").length;while(E.firstChild){E.removeChild(E.firstChild)}E.style.display="none";if(D>0){rExp=new RegExp("("+B.replace(/ /g,"|")+")","gi");newUL=document.createElement("ul");newUL.id="hotel_ul";for(var A=0;A<D;A++){hotelDEBUG=G.getElementsByTagName("p")[A];hotelName=G.getElementsByTagName("p")[A].firstChild.data;hotelID=G.getElementsByTagName("p")[A].getAttribute("id");divText=hotelName.replace(rExp,'<span class="selHighlight">$1</span>');newUL.innerHTML+='<li onmouseover="js_highlightHotelSelection('+A+')" onclick="js_hideAndSelectHotel()"><input type="hidden" id="li_hotel_'+A+'_text" value="'+hotelName+'" /><input type="hidden" id="li_hotel_'+A+'_id" value="'+hotelID+'">'+divText+"</li>"}E.appendChild(newUL);if(navigator.userAgent.match("MSIE 6")){for(A=0;A<hideElements.length;A++){if(document.getElementById(hideElements[A])){document.getElementById(hideElements[A]).style.visibility="hidden"}}}document.getElementById("submitButton").disabled=true;E.style.display="block";js_highlightHotelSelection(0)}else{E.innerHTML+='<div class="noFFResults"><i>no results found</i></div>';E.style.display="block"}if(document.getElementById("hideDiv")){document.getElementById("hideDiv").style.display="block"}}}function js_moveHotelSelection(A){if(!A){A=window.event}if(A.keyCode==38){js_highlightSelection("p")}else{if(A.keyCode==40){js_highlightSelection("n")}else{if(A.keyCode==9||A.keyCode==13){js_hideAndSelect()}else{if((A.keyCode==8||A.keyCode==46)&&document.getElementById("hotel_value").value!=""){document.getElementById("hotel_value").value="";while(document.getElementById("hotel_suggestions").firstChild){document.getElementById("hotel_suggestions").removeChild(document.getElementById("hotel_suggestions").firstChild)}}}}}}function js_highlightHotelSelection(A){curIndex=js_findSelectedHotelIndex();if(document.getElementById("hotel_ul")&&curIndex!==A){list=document.getElementById("hotel_ul");if(A=="n"||A=="p"){if(A=="n"&&curIndex<list.childNodes.length-1){A=curIndex+1}else{if(A=="p"&&curIndex>0){A=curIndex-1}}}if(!isNaN(A)){list.childNodes[A].className="frm_suggest_list_hover";if(curIndex!==false){list.childNodes[curIndex].className=""}}}}function js_hideAndSelectHotel(){selIndex=js_findSelectedHotelIndex();if(!isNaN(selIndex)){$("hotel_suggestions").style.display="none";if($("li_hotel_"+selIndex+"_text")){$("hotel_name").value=$("li_hotel_"+selIndex+"_text").value;$("hotel_value").value=$("li_hotel_"+selIndex+"_id").value;if($("sl_hotel_value")){$("sl_hotel_value").innerHTML=$("li_hotel_"+selIndex+"_id").value}lastSearch=$("hotel_name").value}}js_hideAllPopups()}function js_findSelectedHotelIndex(){if(document.getElementById("hotel_ul")){list=document.getElementById("hotel_ul");nChildren=list.childNodes.length;if(nChildren>0){for(i=0;i<nChildren;i++){if(list.childNodes[i]&&list.childNodes[i].className&&list.childNodes[i].className=="frm_suggest_list_hover"){return i}}}}return false};
