function emailCheck (emailStr) { var checkTLD=1; var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/; var emailPat=/^(.+)@(.+)$/; var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]"; var validChars="\[^\\s" + specialChars + "\]"; var quotedUser="(\"[^\"]*\")"; var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; var atom=validChars + '+'; var word="(" + atom + "|" + quotedUser + ")"; var userPat=new RegExp("^" + word + "(\\." + word + ")*$"); var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$"); var matchArray=emailStr.match(emailPat); if (matchArray==null) { alert("Email address seems incorrect (check @ and .'s)"); return false; } var user=matchArray[1]; var domain=matchArray[2]; for (i=0; i127) { alert("The email field contains invalid characters."); return false; } } for (i=0; i127) { alert("The email domain name contains invalid characters."); return false; } } if (user.match(userPat)==null) { alert("The email doesn't seem to be valid."); return false; } var IPArray=domain.match(ipDomainPat); if (IPArray!=null) { for (var i=1;i<=4;i++) { if (IPArray[i]>255) { alert("The email Destination IP address is invalid!"); return false; } } return true; } var atomPat=new RegExp("^" + atom + "$"); var domArr=domain.split("."); var len=domArr.length; for (i=0;i if ((theForm.phone_area_code.value != "") && (theForm.phone_area_code.value.length < 2)) { alert("Please enter your full 2 digit area code."); theForm.phone_area_code.focus(); return (false); } // Now check for numeric entry only in any non-empty phone field var checkOK = "0123456789"; var checkStr = theForm.phone_area_code.value; var allValid = true; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } } if (!allValid) { alert("Please enter only digits in the \"area code\" field."); theForm.phone_area_code.focus(); return (false); } if ((theForm.day_phone.value != "") && (theForm.day_phone.value.length < 8)) { alert("Please enter your full 8 digit mobile number."); theForm.day_phone.focus(); return (false); } // Now check for numeric entry only in any non-empty phone field var checkOK = "0123456789 -"; var checkStr = theForm.mobile_ext.value; var allValid = true; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } } if (!allValid) { alert("Please enter only digits and a space character in the \"day phone\" field."); theForm.day_phone.focus(); return (false); } if ((checkStr.indexOf(" "))!=(checkStr.lastIndexOf(" "))) { alert("Too many space characters in the \"day phone\" field."); theForm.day_phone.focus(); return (false); } if ((theForm.mobile_prefix.value != "") && (theForm.mobile_prefix.value.length < 4)) { alert("Please enter your full 4 digit mobile prefix."); theForm.mobile_prefix.focus(); return (false); } // Now check for numeric entry only in any non-empty phone field var checkOK = "0123456789"; var checkStr = theForm.mobile_prefix.value; var allValid = true; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } } if (!allValid) { alert("Please enter only digits in the \"mobile prefix\" field."); theForm.mobile_prefix.focus(); return (false); } if ((theForm.mobile_ext.value != "") && (theForm.mobile_ext.value.length < 6)) { alert("Please enter your full 6 digit mobile number."); theForm.mobile_ext.focus(); return (false); } // Now check for numeric entry only in any non-empty phone field var checkOK = "0123456789 -"; var checkStr = theForm.mobile_ext.value; var allValid = true; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } } if (!allValid) { alert("Please enter only digits and a space character in the \"mobile number\" field."); theForm.mobile_ext.focus(); return (false); } if ((checkStr.indexOf(" "))!=(checkStr.lastIndexOf(" "))) { alert("Too many space characters in the \"mobile number\" field."); theForm.mobile_ext.focus(); return (false); } if (theForm.email.value == "") { alert("Please enter your \"Email Address\"."); theForm.email.focus(); return (false); } var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-@-_."; var checkStr = theForm.email.value; var allValid = true; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } } if (!allValid) { alert("Please enter only letter, digit and \"@-_.\" characters in the \"Email Address\" field."); theForm.email.focus(); return (false); } if (emailCheck(theForm.email.value)) { } else { theForm.email.focus(); return (false); } return (true); } function submit_button_onclick() { if (joinup_Validator(document.forms[0])) { document.forms[0].submit(); return true; } }