// JavaScript Document function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for(var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } function trim(stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""); } function ltrim(stringToTrim) { return stringToTrim.replace(/^\s+/,""); } function rtrim(stringToTrim) { return stringToTrim.replace(/\s+$/,""); } function phcheck(pnum) { var phchar="1234567890 -_+.()"; for (i=0;i<=pnum.length;i++) { if(phchar.indexOf(pnum.charAt(i))==-1) { alert("Only Numbers and (+-_. ) are allowed"); return false ; } } return true ; } function validate() { if(trim(document.contact.fname.value)=="") { alert("First name must be filled out!"); document.contact.fname.focus(); return false; } if(trim(document.contact.sname.value)=="") { alert("Surname must be filled out!"); document.contact.sname.focus(); return false; } if(trim(document.contact.address.value)=="") { alert("Address must be filled out!"); document.contact.address.focus(); return false; } if(trim(document.contact.city.value)=="") { alert("City or Town must be filled out!"); document.contact.city.focus(); return false; } if(trim(document.contact.state.value)=="") { alert("Please select state must be filled out!"); document.contact.state.focus(); return false; } if(trim(document.contact.pcode.value)=="") { alert("Postcode must be filled out! "); document.contact.pcode.focus(); return false; } if(isNaN(document.contact.pcode.value)) { alert("Only Numbers for Postcode") document.contact.pcode.value=""; document.contact.pcode.focus() return false; } if(trim(document.contact.email.value)=="") { alert("Email must be filled out!"); document.contact.email.focus(); return false; } if(!echeck(document.contact.email.value)) { document.contact.email.value=""; document.contact.email.focus(); return false; } if(trim(document.contact.phone1.value)=="") { alert("Home Telephone must be filled out!"); document.contact.phone1.focus(); return false; } else if (document.contact.phone1.value!="") { if(isNaN(document.contact.phone1.value)) { document.contact.phone1.value=''; alert("Enter numbers only"); document.contact.phone1.focus(); return false; } } if(trim(document.contact.information.value)=="") { alert("Please send more information must be filled out!"); document.contact.information.focus(); return false; } if(trim(document.contact.comments.value)=="") { alert("Comments must be filled out!"); document.contact.comments.focus(); return false; } return true; } function echeck(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1) { alert("Invalid email address") return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) { alert("Invalid email address") return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) { alert("Invalid email address") return false } if (str.indexOf(at,(lat+1))!=-1) { alert("Invalid email address") return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) { alert("Invalid email address") return false } if (str.indexOf(dot,(lat+2))==-1) { alert("Invalid email address") return false } if (str.indexOf(" ")!=-1) { alert("Invalid email address") return false } return true; }