//www.tailorednews.com/TMsubscribe/emailvalidate.js function emailCheck (emailStr) { 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, there are too many '@' characters or no '@' character, or no '.' in the address. Make sure you have entered your complete address, i.e. 'yourname_40server.ext'"); return false; } var user=matchArray[1]; var domain=matchArray[2]; if (user.match(userPat)==null) { // user is not valid alert("The username in your email address doesn't seem to be valid. Please make sure your complete, correct email address is entered.") return false; } var IPArray=domain.match(ipDomainPat); if (IPArray!=null) { // this is an IP address for (var i=1;i<=4;i++) { if (IPArray[i]>255) { alert("Destination IP address (numeric email address) is invalid!"); return false; } } return true; } var domainArray=domain.match(domainPat); if (domainArray==null) { alert("The domain name (the '@x.x' part of the email address) doesn't seem to be valid. Make sure you have entered your complete, accurate email address, in the format 'name_40server.ext'"); return false; } var atomPat=new RegExp(atom,"g"); var domArr=domain.match(atomPat); var len=domArr.length; if (domArr[domArr.length-1].length<2 || (domArr[domArr.length-1].length>4 && domArr[domArr.length-1].toUpperCase() != "MUSEUM")) { // the address must end in a two, three, or four letter word, OR ".museum". alert("The address must end in a two, three, or four-letter domain (like .uk, .com, .edu, .info, etc.) - Please make sure you entered your email address correctly."); return false; } if (len<2) { alert("Your email address appears to be missing a hostname, please make sure you have entered your complete email address."); return false; } return true; } function postUser(){ if (emailCheck(document.f1.email.value) == false ) {return document.f1.email;} else document.f1.submit(); } function checkRadio(radioName) { var valueSelected = 0; for (r = 0;r