function hw_autocomplete(a){if(a.keyCode==13){searchHostels()}}function searchHostels(){var d=document.getElementById("place_input_key").value.split(",");var e=document.getElementById("hw_country_select");var c;if(d.length==1){if(e.style.display!="block"){e.style.display="block";return false}else{c=document.getElementById("h_country").selectedIndex;if(!c){msgBox("warning","Please select country for this location.");return false}}}else{if(d[1]==0){msgBox("warning","Please type/choose name of the city.");return false}}var b=document.getElementById("h_date").value;var a=document.getElementById("h_nights").value;if(b!=""){if(a==""){msgBox("warning","If you have choosen date please type how many nights you plan to stay.");return false}}else{if(a!=""){document.getElementById("h_nights").value="0"}}document.getElementById("h_date_value").value=b;document.hostels.submit()}function checkBookingAvailability(c,d){var o;var l;var h;var r;var e;var j;switch(d){case"booking_hostel":o=$("HostelsDate").value.split("-");l=$("HostelsDateEnd").value.split("-");h=$("h_currency").value;r=$("h_persons").value;$("h_dateIn").value=$("HostelsDate").value;$("h_dateOut").value=$("HostelsDateEnd").value;$("h_dateInInput").value=$("HostelsDateInput").value;$("h_dateOutInput").value=$("HostelsDateEndInput").value;$("h_personsPage").value=r;$("h_currencyPage").value=h;break;default:o=$("h_dateIn").value.split("-");l=$("h_dateOut").value.split("-");break}var g=null;if(c.name=="hostelsform"){e=$("h_dateInInput").value;j=$("h_dateOutInput").value;o=e.split("/");l=j.split("/");var n=(Date.parse(l[1]+"/"+l[0]+"/"+l[2])-Date.parse(o[1]+"/"+o[0]+"/"+o[2]))/86400000;$("h_nights").value=n;var m=n;r=$("h_personsPage").value;persons_index=$("h_personsPage").selectedIndex;var f=$("h_property").value;h=$("h_currencyPage").value;currency_index=$("h_currencyPage").selectedIndex;var p=$("h_placeKey").value}else{e=$("h_date2").value;j=$("h_dateOut2").value;o=e.split("/");l=j.split("/");var n=(Date.parse(l[1]+"/"+l[0]+"/"+l[2])-Date.parse(o[1]+"/"+o[0]+"/"+o[2]))/86400000;$("h_nights2").value=n;var m=n;r=$("h_persons2").value;persons_index=$("h_persons2").selectedIndex;var f=$("h_property2").value;h=$("h_currency2").value;currency_index=$("h_currency2").selectedIndex;var p=$("h_placeKey2").value}var q=(Date.parse(o[1]+"/"+o[0]+"/"+o[2])-new Date())/86400000;if(q>330){alert("Bookings cannot be made more than 11 months in advance. Please review your check-in date.");return}if(q<1){alert("Please revise your selection. You must use a future date for a new check-in.");return}if(m<1){alert("Please enter a check-out date which occurs after the check-in date.");return}if(m>14){alert("Please revise your reservation dates. The number of nights should not exceed 14.");return}var b=document.getElementById("bookingDiv");var k='<div style="height:160px;padding-top:60px;" align="center"><img src="'+appproxypath+'images/loading.gif"><div style="margin:5px;"><b>Please wait whilst checking availability...</b></div></div>';b.innerHTML=k;ShowPlaceInfo("4");var a="/wayntravels.html?wci=place&wce=getbox&box=bookavailability";a=a+"&StartDate="+e;a=a+"&Property="+f;a=a+"&NightNum="+m;a=a+"&Persons="+r;a=a+"&Currency="+h;a=a+"&placekey="+p;try{g=new Ajax.Request(a,{method:"GET",onSuccess:function(u){responseXml=u.responseXML;for(var t=responseXml.firstChild;t!=null;t=t.nextSibling){for(var s=t.firstChild;s!=null;s=s.nextSibling){if(s.nodeValue!=null&&s.nodeValue!=""){b.innerHTML="";b.innerHTML=s.nodeValue}}}if(currency_index){$("h_currency").selectedIndex=currency_index}if(persons_index){$("h_persons").selectedIndex=persons_index}},onFailure:function(s){document.getElementById("bookingDiv").innerHTML="<center><b>Sorry we're unable to load data at the moment. We will try again in few seconds.</b></center>";return},onException:function(s){document.getElementById("bookingDiv").innerHTML="<center><b>Sorry we're unable to load data at the moment. We will try again in few seconds.</b></center>";return}})}catch(i){msgBox("error",i)}}function changeBookCurrency(a){document.getElementById("b_currency").value=a;document.currencyChangeForm.submit()}function printConfirmation(a){window.print()}function ReviewFocus(){if($("add_review_focus").value=="focus"){$("review_title").focus()}}function BookingHostelClick(){try{xmlRequest=new Ajax.Request("/wayntravels.html?wci=place&wce=savestats&clickbooking=hostel",{method:"GET",onSuccess:function(b){},onFailure:function(b){},onException:function(b){}})}catch(a){}document.bookPlaceForm.submit()};
