// Secure this javascript from being called and executed on behalf of outside websites. var d = new Array("howdysresort.com", "secure.howdysresort.com"); var domaincheck = document.location.href; //retrieve the current URL of user browser var accepted_ok = false; //set acess to false by default if(domaincheck.indexOf("http") != -1 || domaincheck.indexOf("https") != -1) { // If this is an http or https request. for(r = 0; r < d.length; r++) { if(domaincheck.indexOf(d[r]) != -1) { //if a match is found accepted_ok = true; //set access to true, and break out of loop break; } } } else { accepted_ok = true; } if(!accepted_ok) { alert("You're not allowed to directly link to this .js file on our server!"); history.back(-1); } var global_url = ""; var global_location = "/modustpl/_secureXMLReq.php"; function testimonials(a, b) { if(a) { divShowWaitStop(); if(b == "0") { // blacklisted IP address, blacklisted words or phrases, missing, invalid or maxlength fields var error_message = req.responseXML.getElementsByTagName("error_message")[0].firstChild.data; var error_field = req.responseXML.getElementsByTagName("error_field")[0].firstChild.data; alert(error_message); document.getElementById(error_field).focus(); document.getElementById('tm_submit').disabled = false; } else if(b == "1") { // success document.getElementById('div_testimonials').style.display = 'none'; document.getElementById('div_wait_mask').style.display = 'none'; document.getElementById('div_iframe').style.display = 'none'; divShowIsShown = false; divShowName = null; alert("Thank you, your testimonial has been submitted successfully and will be reviewed shortly."); document.getElementById("tm_submit").disabled = false; } else if(b == "2") { // email failed, requires confirmation var error_message = req.responseXML.getElementsByTagName("error_message")[0].firstChild.data; var error_field = req.responseXML.getElementsByTagName("error_field")[0].firstChild.data; var yes = confirm(error_message); if(yes) { divShowWaitStart(); var url_post = global_url + "&emailVerify=1"; loadXML(global_location, url_post); } else { document.getElementById(error_field).focus(); document.getElementById('tm_submit').disabled = false ; } } } else { document.getElementById("tm_submit").disabled = true; var url = "pid=2"; var return_flag = true; var focus_flag = true; var errMessage = "A problem with the fields listed below was encountered:\n\n"; if(document.getElementById("name").value.length > 0) { url += "&name=" + encodeURIComponent(document.getElementById("name").value); } else { if(focus_flag) { focus_flag = false; document.getElementById("name").focus(); } errMessage += "'Name' field missing content.\n"; return_flag = false; } if(document.getElementById("email").value.length > 0) { // If there is something inside the 'emailUpdate' field. if((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,7})+$/.test(document.getElementById("email").value))) { url += "&email=" + encodeURIComponent(document.getElementById("email").value); } else { if(focus_flag) { focus_flag = false; document.getElementById("email").focus(); } errMessage += "'Email' field invalid.\n"; return_flag = false; } } if(document.getElementById("tm_comment").value.length > 0) { if(ismaxlength(document.getElementById("tm_comment").value, 2048)){ url += "&tm_comment=" + encodeURIComponent(document.getElementById("tm_comment").value); } else { if(focus_flag) { focus_flag = false; document.getElementById("tm_comment").focus(); } errMessage += "'Comments' content has exceeded the maximun number of 2048 characters.\n"; return_flag = false; } } else { if(focus_flag) { focus_flag = false; document.getElementById("tm_comment").focus(); } errMessage += "'Comments' field missing content.\n"; return_flag = false; } if(!return_flag) { document.getElementById("tm_submit").disabled = false; alert(errMessage); return(false); } else { global_url = url; var url_post = url + "&emailVerify=0"; divShowWaitStart(); loadXML(global_location, url_post); } } }