function reset_ContactOwnerForm(){ document.contactOwnerForm.contactOwnerForm_checkinyear.selectedIndex = 0; document.contactOwnerForm.contactOwnerForm_checkinmonth.selectedIndex = 0; document.contactOwnerForm.contactOwnerForm_checkinday.selectedIndex = 0; document.contactOwnerForm.contactOwnerForm_numnights.selectedIndex = 0; document.contactOwnerForm.contactOwnerForm_FirstName.value = ""; document.contactOwnerForm.contactOwnerForm_LastName.value = ""; document.contactOwnerForm.contactOwnerForm_Email.value = ""; document.contactOwnerForm.contactOwnerForm_ConEmail.value = ""; document.contactOwnerForm.contactOwnerForm_Phone.value = ""; document.contactOwnerForm.contactOwnerForm_Message.value=""; document.contactOwnerForm.contactOwnerForm_adult.selectedIndex = 0; document.contactOwnerForm.contactOwnerForm_child.selectedIndex = 0; taCount(document.contactOwnerForm.contactOwnerForm_Message,'contactOwnerForm_myCounter'); document.contactOwnerForm.contactOwnerForm_newsletter.checked=false; document.contactOwnerForm.contactOwnerForm_captcha.value = ""; } function submit_ContactOwnerForm_Error(error,field) { alert (error); field.focus(); return false; } function submit_ContactOwnerForm(theForm){ if (theForm.contactOwnerForm_FirstName.value == "") return submit_ContactOwnerForm_Error('Please enter your first name.',theForm.contactOwnerForm_FirstName); if (theForm.contactOwnerForm_LastName.value == "") return submit_ContactOwnerForm_Error('Please enter your last name.',theForm.contactOwnerForm_LastName); if (theForm.contactOwnerForm_Email.value == "") return submit_ContactOwnerForm_Error('Please enter your email address.',theForm.contactOwnerForm_Email); if (theForm.contactOwnerForm_Phone.value == "") return submit_ContactOwnerForm_Error('Please enter your phone.',theForm.contactOwnerForm_Phone); if (theForm.contactOwnerForm_Message.value == "") return submit_ContactOwnerForm_Error('Please enter your message.',theForm.contactOwnerForm_Message); //Captcha if (theForm.contactOwnerForm_captcha.value == ""){ return submit_ContactOwnerForm_Error('Please enter the code.',theForm.contactOwnerForm_captcha);} else if (theForm.contactOwnerForm_captcha.value != document.getElementById("accesscodecheck").value) { return submit_ContactOwnerForm_Error('Please enter the correct code.',theForm.contactOwnerForm_captcha); } // Check confirm email address email2 = theForm.contactOwnerForm_ConEmail.value; email1 = theForm.contactOwnerForm_Email.value; if (email2 != email1) { alert ("Email addresses do not match - please re-enter!"); return false; } // Good to send string = "firstname="+encodeURIComponent(theForm.contactOwnerForm_FirstName.value); string += "&lastname="+encodeURIComponent(theForm.contactOwnerForm_LastName.value); string += "&email="+encodeURIComponent(theForm.contactOwnerForm_Email.value); string += "&phone="+encodeURIComponent(theForm.contactOwnerForm_Phone.value); string += "&message="+encodeURIComponent(theForm.contactOwnerForm_Message.value); string += "&villaid="+encodeURIComponent(theForm.contactOwnerForm_Villaid.value); string += "&adult="+theForm.contactOwnerForm_adult[theForm.contactOwnerForm_adult.selectedIndex].value; string += "&child="+theForm.contactOwnerForm_child[theForm.contactOwnerForm_child.selectedIndex].value; string += "&year="+theForm.contactOwnerForm_checkinyear[theForm.contactOwnerForm_checkinyear.selectedIndex].value; string += "&month="+theForm.contactOwnerForm_checkinmonth[theForm.contactOwnerForm_checkinmonth.selectedIndex].value; string += "&day="+theForm.contactOwnerForm_checkinday[theForm.contactOwnerForm_checkinday.selectedIndex].value; string += "&night="+theForm.contactOwnerForm_numnights[theForm.contactOwnerForm_numnights.selectedIndex].value; string += "captcha="+encodeURIComponent(theForm.contactOwnerForm_captcha.value); if (theForm.contactOwnerForm_newsletter.checked) string += "&newsletter=1"; var xmlhttp; if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { alert(xmlhttp.responseText); } else if (xmlhttp.readyState==4 && xmlhttp.status != 200) { alert("An error occurred when sending the enquiry. Please try again later"); } } xmlhttp.open("POST","/contact-owner-send.php",true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.send(string); close_ContactOwner(); return false; } var bName = navigator.appName; function taLimit(taObj) { if (taObj.value.length==300) return false; return true; } function taCount(taObj,Cnt) { objCnt=createObject(Cnt); objVal=taObj.value; if (objVal.length>300) objVal=objVal.substring(0,300); if (objCnt) { if(bName == "Netscape"){ objCnt.textContent=300-objVal.length;} else{objCnt.innerText=300-objVal.length;} } return true; } function createObject(objId) { if (document.getElementById) return document.getElementById(objId); else if (document.layers) return eval("document." + objId); else if (document.all) return eval("document.all." + objId); else return eval("document." + objId); } function open_ContactOwner() { reset_ContactOwnerForm(); document.getElementById("contactOwner_fade").style.height = ''+(document.getElementById("mainsite").offsetHeight+document.getElementById("mainsite").offsetTop*2)+'px'; document.getElementById("contactOwner_fade").style.display='block'; document.getElementById("contactOwner_light").style.top = ''+($(window).scrollTop()+$(window).height()/10)+'px'; document.getElementById("contactOwner_light").style.display='block'; } function loadandopen_ContactOwner(villaid) { var xmlhttp; if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { $("#contactOwner_light").html(xmlhttp.responseText); open_ContactOwner(); } else if (xmlhttp.readyState==4 && xmlhttp.status != 200) { alert("An error occurred when sending the enquiry. Please try again later"); } } xmlhttp.open("POST","/contact-owner.php?propertyid="+villaid,true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.send(); } function close_ContactOwner() { document.getElementById("contactOwner_light").style.display='none'; document.getElementById("contactOwner_fade").style.display='none'; }