
function e(name,tag){if(!name)return null;var result=document.getElementById(name);if(!result&&tag){var serverCtrlName=name.replace(/_/g,'$');var regExId=new RegExp("[_$]"+name+"$","ig");var items=document.getElementsByTagName(tag);for(var i=0;i<items.length;i++){var item=items[i];if((item.id&&item.id.match(regExId))||(item.name&&item.name==serverCtrlName))return item;}}return result;}var req;function ajax(url,handler){if(typeof XMLHttpRequest!="undefined")req=new XMLHttpRequest();else if(window.ActiveXObject)req=new ActiveXObject("Microsoft.XMLHTTP");req.open("GET",url+"&r="+Math.random(),true);req.onreadystatechange=handler;req.send(null);}function RegionChanged(){var list=e('regionList');ajax(urlBase+'SearchList.aspx?rid='+list.options[list.selectedIndex].value,UpdateLocalities);var region=e('ajaxPoints','input');region.value=list.options[list.selectedIndex].value;var listCountry=e('countryList');if(typeof UpdateGoogelMap!="undefined"){if(listCountry!=null){UpdateGoogelMap(list.options[list.selectedIndex].innerHTML,"",listCountry.options[listCountry.selectedIndex].innerHTML);}else{UpdateGoogelMap(list.options[list.selectedIndex].innerHTML,"","");}}}function StateChanged(){var list=e('stateList');ajax(urlBase+'SearchList.aspx?sid='+list.options[list.selectedIndex].value,UpdateRegions);var region=e('ajaxPoints','input');region.value=list.options[list.selectedIndex].value;var listCountry=e('countryList');if(typeof UpdateGoogelMap!="undefined"){if(listCountry!=null){UpdateGoogelMap(list.options[list.selectedIndex].innerHTML,"",listCountry.options[listCountry.selectedIndex].innerHTML);}else{UpdateGoogelMap(list.options[list.selectedIndex].innerHTML,"","");}}}function UpdateLocalities(){if(req.readyState==4&&req.status==200){e("localities").innerHTML=req.responseText;}}function CountryChanged(){var list=e('countryList');if(list.options[list.selectedIndex].value=="227"){var affiliateid="";var list_1=e('intAffiliateId','input');if(list_1.value!=0)affiliateid="?referrerid="+list_1.value;window.location="http://www.takeabreak.com.au"+affiliateid;}else{ajax(urlBase+'SearchList.aspx?cid='+list.options[list.selectedIndex].value,UpdateRegions);if(typeof UpdateGoogelMap!="undefined"){UpdateGoogelMap("","","");}}}function UpdateRegions(){if(req.readyState==4&&req.status==200){e("regions").innerHTML=req.responseText;RegionChanged();}}function LoclityChanged(){var list=e('regionList');var list_1=e('localityList');var listCountry=e('countryList');if(typeof UpdateGoogelMap!="undefined"){if(listCountry!=null)UpdateGoogelMap(list.options[list.selectedIndex].innerHTML,list_1.options[list_1.selectedIndex].innerHTML,listCountry.options[listCountry.selectedIndex].innerHTML);else
UpdateGoogelMap(list.options[list.selectedIndex].innerHTML,list_1.options[list_1.selectedIndex].innerHTML,"");}}function AccommodationTypeChanged(){var list=e('propertyTypeList','select');if(list.options[list.selectedIndex].value=="-1")ajax(urlBase+'SearchList.aspx?tid=t',UpdateAccommodationType);}function UpdateAccommodationType(){if(req.readyState==4&&req.status==200){e("types").innerHTML=req.responseText;e("propertyTypeList").focus();}}function AccommodationFacilityChanged(){var list=e('facilityList','select');if(list.options[list.selectedIndex].value=="-1")ajax(urlBase+'SearchList.aspx?fid=f',UpdateAccommodationFacility);}function UpdateAccommodationFacility(){if(req.readyState==4&&req.status==200){e("facilities").innerHTML=req.responseText;e("facilityList").focus();}}function AutoKeyDown(){if(document.createEvent){var eventObj=window.document.createEventObject();eventObj.AltKey=true;eventObj.keyCode=40;window.document.fireEvent("onclick",eventObj);event.cancelBubble=true;}}function AutoKeyDown_1(){if(document.createEvent){if(window.KeyEvent){var evObj=document.createEvent('KeyEvents');evObj.initKeyEvent('keypress',0,0,null,0,0,0,0,0,40);}}}function returnTab(evt){var sl=document.getElementById("select1");sl.focus();sl.setSelectedIndex=1;var k=window.event?event.keyCode:evt.which;var Event=document.createEvent("KeyEvents");Event.initKeyEvent("keypress",0,0,null,0,0,0,0,0,18);Event.initKeyEvent("keypress",0,0,null,0,0,0,0,0,40);evt.target.dispatchEvent(Event);evt.preventDefault();}