// Hotel javascript function doSubmitHotel(formName){ if(formName == '' || !formName){ formName = 'searchFormMain'; } // formObj = eval('document.'+formName+';'); formObj = document.forms[formName]; if(validateFormHotel(formName)){ formObj.submit(); Display('searching'); document.location.hash='top'; } } function validateFormHotel(formName){ if(formName == '' || !formName){ formName = 'searchFormMain'; } //var obj = eval('document.'+formName+';'); var obj = document.forms[formName]; var formCheck= true; if(obj.nAdult0){ strPopUp = "nChild0="+obj.nChild0.selectedIndex+"&nChild1="+obj.nChild1.selectedIndex; if(obj.nAdult0.selectedIndex == 0){ obj.nAdult0.focus(); alert("The first room must have at least one adult"); return false; } if(obj.nAdult1.selectedIndex == 0 && obj.nChild1.selectedIndex >0){ obj.nAdult1.focus(); alert("The second room must have at least one adult"); return false; } if(obj.nChild2){ strPopUp = strPopUp + "&nChild2="+obj.nChild2.selectedIndex; if(obj.nAdult2.selectedIndex == 0 && obj.nChild2.selectedIndex >0){ obj.nAdult2.focus(); alert("The third room must have at least one adult"); return false; } } if(obj.nChild3){ strPopUp = strPopUp + "&nChild3="+obj.nChild3.selectedIndex; if(obj.nAdult3.selectedIndex == 0 && obj.nChild3.selectedIndex >0){ obj.nAdult3.focus(); alert("The fourth room must have at least one adult"); return false; } } doPopUp = false; if(obj.cAge1.value =="" && obj.nChild0.selectedIndex>0){ doPopUp = true; } if(obj.cAge2.value =="" && obj.nChild1.selectedIndex >0){ doPopUp = true; } if(obj.nChild2){ if(obj.cAge3.value =="" && obj.nChild2.selectedIndex >0){ doPopUp = true; } } if(obj.nChild3){ if(obj.cAge4.value =="" && obj.nChild3.selectedIndex >0){ doPopUp = true; } } }else{ doPopUp = false; strPopUp = "nr="+obj.nr.value+"&nChild="+obj.nChild.selectedIndex; if(obj.nAdult.selectedIndex == 0){ obj.nAdult.focus(); alert("The first room must have at least one adult"); return false; } if(obj.nChild.selectedIndex > 0){ for(x=0; x < obj.nr.value; x++){ if(eval('obj.cAge'+(x+1)+'.value') == "" ){ doPopUp = true; } } } } if(doPopUp){ url = "/select_child_age.php?lang=en&formName="+formName+"&"+strPopUp; window.open(url,'_blank','location=no,menubar=no,scrollbars=yes,width=300,height=300,screenX=0,screenY=0,top=100,left=100'); return false; } return formCheck; } function doCheckCountry(formName, selObj){ var obj = eval('document.'+formName+'.selectDestRefine'); if(selObj.value == ""){ alert('Please Select a destination inside the country'); obj.focus(); return false; } } function doBuildZone(formName, selObj , hotelLang){ var obj = eval('document.'+formName+'.selectDestRefine'); dest = selObj.value.substr(0,(selObj.value.length - 1)); // lastChar = selObj.value.substr((selObj.value.length - 1),selObj.value.length); initText = 'select a city'; if(selObj.value == ""){ alert('Please Select a destination not a country'); obj.length = 0; obj.options[0].text = initText; obj.options[0].value = ""; return false; }else{ // arDestZone = null; } arDestZone = new Array(); obj.length = 1; obj.options[0].text = 'Loading...'; var scriptElem = document.createElement('script'); scriptElem.setAttribute('src','/js/geo/'+dest+'_'+ hotelLang +'_loc.js'); scriptElem.setAttribute('type','text/javascript'); document.getElementsByTagName('head')[0].appendChild(scriptElem); //alert('/js/'+dest+'_'+ hotelLang +'_loc.js'); setTimeout("doPopulateDest('"+formName+"')",1200); } var intLoop; function doPopulateDest(formName){ var obj = eval('document.'+formName+'.selectDestRefine'); initText = 'select a city'; if( arDestZone.length == 0 && intLoop < 5){ intLoop++; setTimeout("doPopulateDest('"+formName+"')",1200); } obj.length = arDestZone.length obj.options[0].text = initText; obj.options[0].value = ""; for(x=1;x < arDestZone.length;x++){ obj.options[x].text = arDestZone[x][1]; obj.options[x].value = arDestZone[x][0]; } obj.selectedIndex = 0; }