var selectcountries = "";var xmlHttp = createXmlHttpRequestObject(); function createXmlHttpRequestObject(){ var ret; if(window.ActiveXObject){ try{ xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { xmlHttp = false; } } else { try{ xmlHttp = new XMLHttpRequest(); } catch (e) { xmlHttp = false; } } if (!xmlHttp){ alert("Error creating the XMLHttpRequest Object."); } else { return xmlHttp; } } function processChange(){ if(xmlHttp.readyState == 4 || xmlHttp.readyState == 0){ countryID = encodeURIComponent(document.getElementById("countryID").value); xmlHttp.open("GET", "countries.php?countryID=" + countryID, true); xmlHttp.onreadystatechange = handleServerResponse; xmlHttp.send(null); zip = document.getElementById('zip or postal'); if (countryID == '999'){ str2 = "Country:"; document.getElementById("countries").innerHTML = str2; zip.title = 'names2'; } } else { // setTimeout('process()',1000); } } function processLoad(){ if(xmlHttp.readyState == 4 || xmlHttp.readyState == 0){ // countryID = encodeURIComponent(document.getElementById("countryID").value); countryID = '105'; xmlHttp.open("GET", "countries.php?countryID=" + countryID, true); xmlHttp.onreadystatechange = handleServerResponse; xmlHttp.send(null); } else { // setTimeout('process()',1000); } } function handleServerResponse(){ if(xmlHttp.readyState == 4){ if(xmlHttp.status == 200){ // xmlResponse = xmlHttp.responseXML; // xmlDocumentElement = xmlResponse.documentElement; // subMessage = xmlDocumentElement.firstChild.data; str = xmlHttp.responseText; document.getElementById("divSubs").innerHTML = str; // setTimeout("process()",1000); } else { alert("There was a problem accessing the server " + xmlHttp.statusText); } } } function v_names2_mandatory(el){// names - works for o'brian, zeta-jones var t = el.value; var pat = /[^\w^'^-^\s]/; var v = new RegExp(pat); var tt = v.exec(t); if(!(!(tt))){ problems += el.name + " shouldn't contain disallowed character "+tt+"\n"; } if(!t.length){ problems += el.name + "\n"; } } function v_telephone(el){ var t = el.value; var pat = /[^\d()\-\s]/; var v = new RegExp(pat); var tt = v.exec(t); if(!(!(tt))){ problems += el.name + " shouldn't contain disallowed character "+tt+"\n"; } } function v_names2(el){// names - works for o'brian, zeta-jones var t = el.value; var pat = /[^\w^'^-^\s]/; var v = new RegExp(pat); var tt = v.exec(t); if(!(!(tt))){ problems += el.name + " shouldn't contain disallowed character "+tt+"\n"; } } function v_has_value(el){// greater than zero t = el.value; if(!(t.length > 0)){ problems += el.name +" must be filled in\n"; } } function v_gtzero(el){// greater than zero t = el.value; if(!(t>0)){ problems += el.name +" must be selected\n"; } } function v_not_zero(el){// not zero t = el.value; if((t==0)){ problems += el.name +" must be selected\n"; } } function v_addresses_mandatory(el){ var str = el.value; if (!str.length){ problems += el.name + "\n"; } var PAT = new RegExp(/[^\w^'^-^.^\s]/); var tt = PAT.exec(str); if (tt){ problems += el.name + " should not contain " + tt +"\n"; } } function v_addresses(el){ var str = el.value; var PAT = new RegExp(/[^\w^'^-^.^\s]/); var tt = PAT.exec(str); if (tt){ problems += el.name + " should not contain " + tt; } } function v_postal(el){// is a zipcode or canadian postal code var pat = /(^\d{5}$)|[A-Z]\d[A-Z] \d[A-Z]\d/; // var pat = "(^\d{5}$)|(^\d{5}-\d{4}$)"; var validator = new RegExp(pat); var t = el.value; if (! validator.test(t)){ problems += el.name + " isn't a valid zip or postal code\n"; } } function v_email_mandatory(el){ var t = el.value; if(t.length > 0){ var pat = /^(.+)@(.+)$/; // var pat = /[^\w^'^-]/; var v = new RegExp(pat); var tt = v.exec(t); if(!(tt)){ problems += "not a valid email address\n"; } if (t.length > 128){ problems += el.name +" entry is longer than allowable "; } } else { problems += el.name + " must be entered\n"; } } function v_phone(el){// var t = el.value; // var pat = /^\(\d\d\d\) \d\d\d-\d\d\d\d$/; var v = new RegExp(pat); var tt = v.exec(t); if(!(tt)){ problems += el.name +" - Phone numbers must be entered in this format: (NNN) NNN-NNNN\n"; } } function validateForm(ob){ var e; problems = ""; var msg = "Please correct or fill in:\n"; // Call the form an array for clarity elArray = ob.form; for(var i = 0; i < elArray.length; i++){ if(elArray[i].title){ f = "v_" + elArray[i].title +"(elArray[i]);"; try{ eval(f); } catch (e){ } finally{ if(e){ problems += elArray[i].title + " validator is missing"; } } } } if(problems.length){ alert(msg + problems); return false; } else { return true; } }