// generated Mon Dec 28 23:08:26 EST 2009

function hcount(cityid){}function onHotel(i,autosubmit){formAlreadySubmitted=false;if(i>=0){if(rHtlSearch.length>i){if(rHtlSearch[i].hcntry=="US"){document.hotels.location.value=rHtlSearch[i].hcity+", "+rHtlSearch[i].hstate}else{if(rHtlSearch[i].hcntry=="CA"){document.hotels.location.value=rHtlSearch[i].hcity+", "+rHtlSearch[i].hstate+" "+rHtlSearch[i].hcntryname}else{document.hotels.location.value=rHtlSearch[i].hcity+", "+rHtlSearch[i].hcntryname}}var todayDate=new Date();todayDate.setHours(0);todayDate.setMinutes(0);todayDate.setSeconds(0);todayDate.setMilliseconds(0);var testInDate=new Date();testInDate.setTime(Date.parse(rHtlSearch[i].hin));var testOutDate=new Date();testOutDate.setTime(Date.parse(rHtlSearch[i].hout));if(testInDate!=null&&testInDate.getTime()>=todayDate.getTime()){datePicker.checkinDate.setFromCanonical(rHtlSearch[i].hin);datePicker.checkoutDate.setFromCanonical(rHtlSearch[i].hout)}else{if(!isNaN(Date.parse(rHtlSearch[i].hin))){alert("The dates for this hotel search have expired, please enter new dates.");autosubmit=false}datePicker.checkinDate.clearDay();datePicker.checkoutDate.clearDay()}document.hotels.hid.value=rHtlSearch[i].hid;selectByValue(document.hotels.rooms,rHtlSearch[i].hroom);roomsChanged();if(rHtlSearch[i].hroom=="1"){selectByValue(document.hotels.guests1,rHtlSearch[i].hguest)}else{selectByValue(document.hotels.guests2,rHtlSearch[i].hguest)}document.hotels.othercity.value=document.hotels.location.value;document.hotels.citycode.value=rHtlSearch[i].hhint;hcount(rHtlSearch[i].hhint);selectByValue(document.hotels.minstars,rHtlSearch[i].hstars);selectByValue(document.hotels.provider,rHtlSearch[i].brandid);selectByValue(document.hotels.maxprice,rHtlSearch[i].maxprice);if(rHtlSearch[i].hlandmark!=null){if(rHtlSearch[i].hlandmark.lmid!=""){document.hotels.searchType.value="C";document.hotels.lmid.value=rHtlSearch[i].hlandmark.lmid}else{document.hotels.searchType.value="A";document.hotels.lmid.value="";document.hotels.address.value=rHtlSearch[i].hlandmark.addr;if(rHtlSearch[i].hlandmark.addr!=rHtlSearch[i].hlandmark.name){document.hotels.address_nickname.value=rHtlSearch[i].hlandmark.name}}}else{document.hotels.searchType.value="C"}initGeocoder();document.hotels.recent.value="Y"}if(autosubmit){if(hotelsubmit()){document.hotels.submit();document.body.style.cursor="wait"}}}}function changelocation(){var form=document.hotels;if(form.newlocation!=null){var i=form.newlocation.selectedIndex;var newloc=form.newlocation.options[i].value.split(":");if(newloc.length>1){form.citycode.value=newloc[1]}else{form.citycode.value=""}if(newloc.length>3){if(newloc[2]=="lmid"){form.lmid.value=newloc[3]}else{if(newloc[2]=="hid"){form.hid.value=newloc[3]}}}form.location.value=newloc[0];form.othercity.value=newloc[0];form.lat.value="";form["long"].value="";disableSearchButton();form.submit()}}function roomsChanged(){if(document.hotels.rooms.value=="3"){if(window.confirm("We only support searching for up to two rooms at once, would you like to use our partner site Hotelplanner.com to search for multiple rooms?")){var hpurl="/k/redirect/out?url=http%3A//www.hotelplanner.com/?sc=%3D"+getGroopleTrack();var hpwin=window.open(hpurl);if(hpwin==null){alert("Please make sure you turn off popup blockers if you wish to go to Hotelplanner.com.")}}document.hotels.rooms.value="1"}else{if(document.hotels.rooms.value=="2"){var g1=document.hotels.guests1.value-1;document.hotels.guests1.style.display="none";document.hotels.guests2.style.display="inline";if(g1==0){g1++}document.hotels.guests2[g1].selected=true}else{var g2=document.hotels.guests2.value-1;document.hotels.guests1.style.display="inline";document.hotels.guests2.style.display="none";if(g2<4){document.hotels.guests1[g2].selected=true}}}}var missingLocationMsg="Please enter a city or address.";function hotelsubmit(){if(Profiler.isEnabled()){Profiler.clearAll();Profiler.markPoint("s0000")}if(formAlreadySubmitted){return false}var loc=document.hotels.othercity.value;if(loc.length<1){alert(missingLocationMsg);return false}else{if(document.hotels.rooms.value=="1"){document.hotels.guests.value=document.hotels.guests1.value}else{document.hotels.guests.value=document.hotels.guests2.value}}if(datePicker.checkoutDate.fields().day!=-1||datePicker.checkinDate.fields().day!=-1){if(datePicker.checkinDate.fields().day<1){alert("Please enter a check-in date.");return false}if(datePicker.checkoutDate.fields().day<1){alert("Please enter a check-out date.");return false}var checkin=datePicker.checkinDate.valueAsDate();var checkout=datePicker.checkoutDate.valueAsDate();if(checkout<=checkin){alert("The check-out date must be after the check-in date.");checkin_date_changed();return false}}if(document.hotels.location.value==""){document.hotels.location.value=loc}if(document.hotels.citycode.value.length<1&&document.hotels.othercity.value!=document.hotels.geocodefailed.value){geocodeAddress(true);return false}if(document.hotels.location.value.length>0){cancelSmartBox();if(datePicker.checkoutDate.fields().day==-1||datePicker.checkinDate.fields().day==-1){uncheckcomparetos(document.hotels)}if(comparewindows(document.hotels)){disableSearchButton();return true}else{popupBlockerMsg(document.hotels);return false}}}function disableSearchButton(){if(document.hotels.Search){document.hotels.Search.disabled=true}document.lasttab.havesearched.value="true";document.body.style.cursor="wait";swapButtons();formAlreadySubmitted=true}function smarboxcb(data){if(data!=null){if(data.lmid!=null){document.hotels.lmid.value=data.lmid}else{document.hotels.lmid.value=""}}compare2chk()}function hotel_smartboxcb(data){if(data!=null){if(data.hid!=null){document.hotels.hid.value=data.hid}else{document.hotels.hid.value=""}if(data.lmid!=null){document.hotels.lmid.value=data.lmid}else{document.hotels.lmid.value=""}}compare2chk()}function rebuildbrandfilter(bidlist){var bidLookup=new Object();var bids=new Array();if(bidlist!=null){bids=bidlist.split(",");for(var i=0;i<bids.length;i++){bidLookup[bids[i]]=bids[i]}}var selectlist=document.getElementById("brandSelect");var currentvalue=selectlist.value;var separatorShown=false;var parentFound=false;selectlist.options.length=0;selectlist.options[0]=new Option("Any","-1",(currentvalue=="-1"),(currentvalue=="-1"));for(var i=0;i<bList.length;i++){if(!separatorShown&&parentFound&&(bList[i].display.indexOf(")")<0)){selectlist.options[selectlist.options.length]=new Option("-----------------------",-1,false,false);separatorShown=true}if(bidLookup[parseInt(bList[i].id)]!=null){selectlist.options[selectlist.options.length]=new Option(bList[i].display,bList[i].id,(currentvalue==bList[i].id),(currentvalue==bList[i].id));if(bList[i].display.indexOf(")")>0){parentFound=true}}}}function cityfocus(){initSmartBox(document.hotels.othercity,document.hotels.citycode,"hotel",30,175,smarboxcb,null,false,null,true)}function hotelfocus(){initSmartBox(document.hotels.othercity,document.hotels.citycode,"hotel",100,460,hotel_smartboxcb,"/f/smarty",false,null,true)}function checkin_date_changed(){var departing=datePicker.checkinDate.valueAsDate();var returning=datePicker.checkoutDate.valueAsDate();if(returning==null||departing>returning){datePicker.checkoutDate.setFromCanonical(addDays(departing,3))}}function onDateChange(year,month,day,event){var checkin=parseDate(document.hotels.checkin_date.value);var checkout=parseDate(document.hotels.checkout_date.value);if(checkin>checkout){document.hotels.checkout_date.value=addDays(checkin,3)}}function initGeocoder(){document.getElementById("mapframe").src="/maps/geocoder?w=1&h=1"}function clearGeocode(){var form=document.hotels;form.searchType.value="C";form.address.value=form.address_nickname.value=form.lat.value="";form.postalcode.value=form.location.value=form["long"].value="";form.geocodefailed.value=""}function addressResult(response){var form=document.hotels;var place=null;clearGeocode();if(response&&response.Status.code==200&&response.Placemark){place=response.Placemark[0]}if(place&&place.AddressDetails&&place.AddressDetails.Country){var cc=place.AddressDetails.Country.CountryNameCode;var loc=place.address.split(", ");var len=loc.length;var lmin=(cc=="US"||cc=="CA"?3:2);if(len>=lmin){form.searchType.value="A";if(cc=="US"){form.location.value=loc[len-3]+","+loc[len-2].substring(0,2)+",US";form.postalcode.value=loc[len-2].substring(3)}else{if(cc=="GB"){var regex=new RegExp(/.* [0-9]/);if(regex.test(loc[len-2])){var cityparts=loc[len-2].split(" ");var clen=cityparts.length;form.location.value=cityparts.slice(0,clen-2)+",United Kingdom";form.postalcode.value=cityparts[clen-2]+" "+cityparts[clen-1]}else{form.location.value=loc.slice(len-2,len-1)+",United Kingdom"}}else{if(cc=="RU"){form.location.value=loc[len-1]+","+loc[len-2]}else{form.location.value=loc.slice(len-lmin)}}}if(len>=lmin+1){form.address.value=loc[len-lmin-1]}if(len>=lmin+2){form.address_nickname.value=loc[0]}if(place.Point&&place.Point.coordinates){form["long"].value=place.Point.coordinates[0];form.lat.value=place.Point.coordinates[1]}}}if(form.location.value.length>0){if(place){form.othercity.value=place.address}}else{form.geocodefailed.value=form.othercity.value}}function submitAddressResult(response){addressResult(response);disableSearchButton();document.hotels.submit()}function geocodeAddress(doSubmit){var searchstring=document.hotels.geocodefailed.value=document.hotels.othercity.value;if(document.hotels.citycode.value.length<1&&!document.hotels.newlocation){var words=searchstring.split(/\W+/);if(words.length>2||searchstring.indexOf(",")>=0){document.hotels.geocodefailed.value="";if(doSubmit){window.frames.mapframe.geoCodeAddressList(searchstring,submitAddressResult)}else{window.frames.mapframe.geoCodeAddressList(searchstring,addressResult)}}}};

var jsck_fdhotel="v293";
// generation time: 3ms
