function setErrorText(b,a){if(document.all){document.getElementById(b).innerText=a}else{document.getElementById(b).textContent=a}}function isValidHotel(o,f,k){var c=document.forms[""+o].chdroom1.value;var h=document.forms[""+o].adt1.value;var p=parseInt(h)+parseInt(c);var d=isDate(f,o);if(!d){return false}var r=isDate(k,o);if(!r){return false}var f=f.split("/");var k=k.split("/");var e=f[0];var q=f[2];var v=(f[1]-1);var l=k[0];var a=k[2];var t=(k[1]-1);var s=new Date();var n=s.getDate();if(n<10){n="0"+n}var i=s.getMonth();if(i<10){i="0"+i}var b=s.getFullYear();var u=daysElapsed(new Date(a,t,l),new Date(q,v,e));var j=daysElapsed(new Date(q,v,e),new Date(b,i,n));if(j<0){alert("Depart date can't be in past");return false}if(document.forms[""+o].cityname){if(document.forms[""+o].cityname.value==""){alert("City name can not be blank.");document.forms[""+o].cityname.focus();return false}var m=document.getElementById("city").value;if(Trim(m)==""){alert("City name cannot start with a space.");return false}if(m.length<=2){alert("Please enter the first 3 letters of the city name.");return false}var g=validate_city_name(document.forms[""+o].cityname.value);if(g==0){alert("Numeric city:Please enter valid city name");document.forms[""+o].cityname.focus();return false}}if(u<0){alert("Check-out date must occur after the Check-in date.");return false}if(u>14){alert("Your stay period can not be more than 14 for online hotel booking. If your stay period is more than this, please call our call center.");return false}if(u==0){alert("Check-out and Check-in date can't be same.");return false}if((p>4)&&(document.forms[""+o].adt1_chdage1.value>4)&&(document.forms[""+o].adt1_chdage2.value>4)){alert("You are allowed a maximum of 4 guests per booking online.\n If your booking is larger than this , please call our call centre.");return false}if(document.forms[""+o].chdroom1.value=="1"&&document.forms[""+o].adt1_chdage1.value==""){alert("Please enter the child age");return false}if(document.forms[""+o].chdroom1.value=="2"&&(document.forms[""+o].adt1_chdage1.value==""||document.forms[""+o].adt1_chdage2.value=="")){alert("Please enter the children ages ");return false}return true}function isValidHotel_new(o,f,k){var c=document.forms[""+o].CHD.value;var h=document.forms[""+o].ADT.value;var p=parseInt(h)+parseInt(c);var d=isDate(f,o);if(!d){return false}var r=isDate(k,o);if(!r){return false}var f=f.split("/");var k=k.split("/");var e=f[0];var q=f[2];var v=(f[1]-1);var l=k[0];var a=k[2];var t=(k[1]-1);var s=new Date();var n=s.getDate();if(n<10){n="0"+n}var i=s.getMonth();if(i<10){i="0"+i}var b=s.getFullYear();var u=daysElapsed(new Date(a,t,l),new Date(q,v,e));var j=daysElapsed(new Date(q,v,e),new Date(b,i,n));if(j<0){alert("Depart date can't be in past");return false}if(document.forms[""+o].cityname){if(document.forms[""+o].cityname.value==""){alert("City name can not be blank.");document.forms[""+o].cityname.focus();return false}var m=document.getElementById("city").value;if(Trim(m)==""){alert("City name cannot start with a space.");return false}if(m.length<=2){alert("Please enter the first 3 letters of the city name.");return false}var g=validate_city_name(document.forms[""+o].cityname.value);if(g==0){alert("Numeric city:Please enter valid city name");document.forms[""+o].cityname.focus();return false}}if(u<0){alert("Check-out date must occur after the Check-in date.");return false}if(u>14){alert("Your stay period can not be more than 14 for online hotel booking. If your stay period is more than this, please call our call center.");return false}if(u==0){alert("Check-out and Check-in date can't be same.");return false}if((p>4)&&(document.forms[""+o].age1.value>4)&&(document.forms[""+o].age2.value>4)){alert("You are allowed a maximum of 4 guests per booking online.\n If your booking is larger than this , please call our call centre.");return false}if(document.forms[""+o].CHD.value=="1"&&document.forms[""+o].age1.value==""){alert("Please enter the child age");return false}if(document.forms[""+o].CHD.value=="2"&&(document.forms[""+o].age1.value==""||document.forms[""+o].age2.value=="")){alert("Please enter the children ages ");return false}return true}function isDate(h,j){var a=DaysArray(12);var g=h.indexOf(dtCh);var f=h.indexOf(dtCh,g+1);var b=h.substring(0,g);var e=h.substring(g+1,f);var c=h.substring(f+1);strYr=c;if(b.charAt(0)=="0"&&b.length>1){b=b.substring(1)}if(e.charAt(0)=="0"&&e.length>1){e=e.substring(1)}for(var d=1;d<=3;d++){if(strYr.charAt(0)=="0"&&strYr.length>1){strYr=strYr.substring(1)}}month=parseInt(e);day=parseInt(b);year=parseInt(strYr);if(j=="modifysearchform"){if(document.modifysearchform.cidate.value==""&&document.modifysearchform.codate.value==""){alert("The date format should be : dd/mm/yyyy");return false}if(document.modifysearchform.cidate.value==""){alert("The date format should be : dd/mm/yyyy");return false}if(document.modifysearchform.codate.value==""){alert("The date format should be : dd/mm/yyyy");return false}}else{if(g==-1||f==-1){alert("The date format should be : dd/mm/yyyy");return false}}if(e.length<1||month<1||month>12){alert("Please enter a valid month");return false}if(b.length<1||day<1||day>31||(month==2&&day>daysInFebruary(year))||day>a[month]){alert("Please enter a valid day");return false}if(c.length!=4||year==0||year<minYear||year>maxYear){alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear);return false}if(h.indexOf(dtCh,f+1)!=-1||isInteger(stripCharsInBag(h,dtCh))==false){alert("Please enter a valid date");return false}return true}function isValidpopup(u,h,q){if(u=="mapviewform"){var j=document.getElementById("NumberOfRooms_PopupMap").value}else{if(u=="popupform1"){var j=document.getElementById("NumberOfRooms_Popup").value}else{if(u=="popupform2"){var j=document.getElementById("NumberOfRooms_PopupCY").value}else{if(u=="popupform3"){var j=document.getElementById("NumberOfRooms_PopupCH").value}else{if(document.getElementById("videotourform")){var j=document.getElementById("NumberOfRooms_PopupVT").value}}}}}var f=0;var i=new Array(3);var d=new Array(3);for(var p=0;p<Number(j);p++){if(u=="mapviewform"){i[p]=document.getElementById("Adult"+(p+1)+"_PopupMap").value;d[p]=document.getElementById("Child"+(p+1)+"_PopupMap").value}else{if(u=="popupform1"){i[p]=document.getElementById("Adult"+(p+1)+"_Popup").value;d[p]=document.getElementById("Child"+(p+1)+"_Popup").value}else{if(u=="popupform2"){i[p]=document.getElementById("Adult"+(p+1)+"_PopupCY").value;d[p]=document.getElementById("Child"+(p+1)+"_PopupCY").value}else{if(u=="popupform3"){i[p]=document.getElementById("Adult"+(p+1)+"_PopupCH").value;d[p]=document.getElementById("Child"+(p+1)+"_PopupCH").value}else{if(document.getElementById("videotourform")){i[p]=document.getElementById("Adult"+(p+1)+"_PopupVT").value;d[p]=document.getElementById("Child"+(p+1)+"_PopupVT").value}}}}}}var a=Number(i[0])+Number(d[0]);var H=Number(i[1])+Number(d[1]);var F=Number(i[2])+Number(d[2]);var E=Number(i[3])+Number(d[3]);if(a>4||H>4||F>4||E>4){alert("You are allowed a maximum of 4 guests per room booking.");return false}var e=isDatepopup(h);if(!e){return false}var w=isDatepopup(q);if(!w){return false}var h=h.split("/");var q=q.split("/");var g=h[0];var v=h[2];var C=(h[1]-1);var o=q[0];var b=q[2];var A=(q[1]-1);var z=new Date();var s=z.getDate();if(s<10){s="0"+s}var l=z.getMonth();if(l<10){l="0"+l}var c=z.getFullYear();var B=daysElapsed(new Date(b,A,o),new Date(v,C,g));var m=daysElapsed(new Date(v,C,g),new Date(c,l,s));if(m<0){alert("Depart date can't be in past");return false}if(B<0){alert("Checkout date must occur after the Checkin date.");return false}if(B>14){alert("Your stay period can not be more than 14 for online hotel booking. \n If your stay period is more than this, please call our call center.");return false}if(B==0){alert("Checkout and Checkin date can't be same.");return false}if(document.getElementById("mapviewform")){document.getElementById("ChildAgeErrorDivpopupmap").style.display="none";var k=new Array(8);k[0]=document.getElementById("PopupMapChildAgeControl11_AgeList");k[1]=document.getElementById("PopupMapChildAgeControl12_AgeList");k[2]=document.getElementById("PopupMapChildAgeControl13_AgeList");k[3]=document.getElementById("PopupMapChildAgeControl14_AgeList");k[4]=document.getElementById("PopupMapChildAgeControl15_AgeList");k[5]=document.getElementById("PopupMapChildAgeControl16_AgeList");k[6]=document.getElementById("PopupMapChildAgeControl17_AgeList");k[7]=document.getElementById("PopupMapChildAgeControl18_AgeList");for(var n=1;n<=4;n++){for(var p=1;p<=2;p++){if(document.getElementById("Child"+n+"_PopupMap").value>0){if(document.getElementById("PopupMapChildAge"+n+""+p).style.display=="block"&&k[p-1+((n-1)*2)].selectedIndex==0){if(document.getElementById("ChildAgeErrorDivpopupmap").style.display!="block"){document.getElementById("ChildAgeErrorDivpopupmap").style.display="block";return false}}}}}}if(document.getElementById("popupform1")){document.getElementById("ChildAgeErrorDivpopup").style.display="none";var r=new Array(8);r[0]=document.getElementById("PopupChildAgeControl11_AgeList");r[1]=document.getElementById("PopupChildAgeControl12_AgeList");r[2]=document.getElementById("PopupChildAgeControl13_AgeList");r[3]=document.getElementById("PopupChildAgeControl14_AgeList");r[4]=document.getElementById("PopupChildAgeControl15_AgeList");r[5]=document.getElementById("PopupChildAgeControl16_AgeList");r[6]=document.getElementById("PopupChildAgeControl17_AgeList");r[7]=document.getElementById("PopupChildAgeControl18_AgeList");for(var n=1;n<=4;n++){for(var p=1;p<=2;p++){if(document.getElementById("Child"+n+"_Popup").value>0){if(document.getElementById("PopupChildAge"+n+""+p).style.display=="block"&&r[p-1+((n-1)*2)].selectedIndex==0){if(document.getElementById("ChildAgeErrorDivpopup").style.display!="block"){document.getElementById("ChildAgeErrorDivpopup").style.display="block";return false}}}}}}if(document.getElementById("popupform2")){document.getElementById("ChildAgeErrorDivpopupcy").style.display="none";var G=new Array(8);G[0]=document.getElementById("PopupCYChildAgeControl11_AgeList");G[1]=document.getElementById("PopupCYChildAgeControl12_AgeList");G[2]=document.getElementById("PopupCYChildAgeControl13_AgeList");G[3]=document.getElementById("PopupCYChildAgeControl14_AgeList");G[4]=document.getElementById("PopupCYChildAgeControl15_AgeList");G[5]=document.getElementById("PopupCYChildAgeControl16_AgeList");G[6]=document.getElementById("PopupCYChildAgeControl17_AgeList");G[7]=document.getElementById("PopupCYChildAgeControl18_AgeList");for(var n=1;n<=4;n++){for(var p=1;p<=2;p++){if(document.getElementById("Child"+n+"_PopupCY").value>0){if(document.getElementById("PopupCYChildAge"+n+""+p).style.display=="block"&&G[p-1+((n-1)*2)].selectedIndex==0){if(document.getElementById("ChildAgeErrorDivpopupcy").style.display!="block"){document.getElementById("ChildAgeErrorDivpopupcy").style.display="block";return false}}}}}}if(document.getElementById("videotourform")){document.getElementById("ChildAgeErrorDivpopupvt").style.display="none";var t=new Array(8);t[0]=document.getElementById("PopupVTChildAgeControl11_AgeList");t[1]=document.getElementById("PopupVTChildAgeControl12_AgeList");t[2]=document.getElementById("PopupVTChildAgeControl13_AgeList");t[3]=document.getElementById("PopupVTChildAgeControl14_AgeList");t[4]=document.getElementById("PopupVTChildAgeControl15_AgeList");t[5]=document.getElementById("PopupVTChildAgeControl16_AgeList");t[6]=document.getElementById("PopupVTChildAgeControl17_AgeList");t[7]=document.getElementById("PopupVTChildAgeControl18_AgeList");for(var n=1;n<=4;n++){for(var p=1;p<=2;p++){if(document.getElementById("Child"+n+"_PopupVT").value>0){if(document.getElementById("PopupVTChildAge"+n+""+p).style.display=="block"&&t[p-1+((n-1)*2)].selectedIndex==0){if(document.getElementById("ChildAgeErrorDivpopupvt").style.display!="block"){document.getElementById("ChildAgeErrorDivpopupvt").style.display="block";return false}}}}}}if(document.getElementById("popupform3")){document.getElementById("ChildAgeErrorDivpopupch").style.display="none";var k=new Array(8);k[0]=document.getElementById("PopupCHChildAgeControl11_AgeList");k[1]=document.getElementById("PopupCHChildAgeControl12_AgeList");k[2]=document.getElementById("PopupCHChildAgeControl13_AgeList");k[3]=document.getElementById("PopupCHChildAgeControl14_AgeList");k[4]=document.getElementById("PopupCHChildAgeControl15_AgeList");k[5]=document.getElementById("PopupCHChildAgeControl16_AgeList");k[6]=document.getElementById("PopupCHChildAgeControl17_AgeList");k[7]=document.getElementById("PopupCHChildAgeControl18_AgeList");for(var n=1;n<=4;n++){for(var p=1;p<=2;p++){if(document.getElementById("Child"+n+"_PopupCH").value>0){if(document.getElementById("PopupCHChildAge"+n+""+p).style.display=="block"&&k[p-1+((n-1)*2)].selectedIndex==0){if(document.getElementById("ChildAgeErrorDivpopupch").style.display!="block"){document.getElementById("ChildAgeErrorDivpopupch").style.display="block";return false}}}}}}return true}function isDatepopup(d){var a=DaysArray(12);var e=d.indexOf(dtCh);var c=d.indexOf(dtCh,e+1);var g=d.substring(0,e);var h=d.substring(e+1,c);var f=d.substring(c+1);strYr=f;if(g.charAt(0)=="0"&&g.length>1){g=g.substring(1)}if(h.charAt(0)=="0"&&h.length>1){h=h.substring(1)}for(var b=1;b<=3;b++){if(strYr.charAt(0)=="0"&&strYr.length>1){strYr=strYr.substring(1)}}month=parseInt(h);day=parseInt(g);year=parseInt(strYr);if(e==-1||c==-1){alert("The date format should be : dd/mm/yyyy");return false}if(h.length<1||month<1||month>12){alert("Please enter a valid month");return false}if(g.length<1||day<1||day>31||(month==2&&day>daysInFebruary(year))||day>a[month]){alert("Please enter a valid day");return false}if(f.length!=4||year==0||year<minYear||year>maxYear){alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear);return false}if(d.indexOf(dtCh,c+1)!=-1||isInteger(stripCharsInBag(d,dtCh))==false){alert("Please enter a valid date");return false}return true}function daysElapsed(b,a){var c=Date.UTC(b.getYear(),b.getMonth(),b.getDate(),0,0,0)-Date.UTC(a.getYear(),a.getMonth(),a.getDate(),0,0,0);return c=(c)/(1000*60*60*24)}var dtCh="/";var minYear=1900;var maxYear=2100;function isInteger(b){var a;for(a=0;a<b.length;a++){var d=b.charAt(a);if(((d<"0")||(d>"9"))){return false}}return true}function stripCharsInBag(d,e){var b;var a="";for(b=0;b<d.length;b++){var f=d.charAt(b);if(e.indexOf(f)==-1){a+=f}}return a}function daysInFebruary(a){return(((a%4==0)&&((!(a%100==0))||(a%400==0)))?29:28)}function DaysArray(b){for(var a=1;a<=b;a++){this[a]=31;if(a==4||a==6||a==9||a==11){this[a]=30}if(a==2){this[a]=29}}return this};