
inc_validemail_js =
'<SCRIPT LANGUAGE="JavaScript">\n\n<!-- This script and m'
+ 'any more are available free online at -->\n<!-- The Java'
+ 'Script Source!! http://javascript.internet.com -->\n\n<!'
+ '-- V1.1.3: Sandeep V. Tamhankar (stamhankar@hotmail.com)'
+ ' -->\n<!-- Original:  Sandeep V. Tamhankar (stamhankar@h'
+ 'otmail.com) -->\n<!-- Changes:\n/* 1.1.4: Fixed a bug wh'
+ 'ere upper ASCII characters (i.e. accented letters\ninter'
+ 'national characters) were allowed.\n\n1.1.3: Added the r'
+ 'estriction to only accept addresses ending in two\nlette'
+ 'rs (interpreted to be a country code) or one of the know'
+ 'n\nTLDs (com, net, org, edu, int, mil, gov, arpa), inclu'
+ 'ding the\nnew ones (biz, aero, name, coop, info, pro, mu'
+ 'seum).  One can\neasily update the list (if ICANN adds e'
+ 'ven more TLDs in the\nfuture) by updating the knownDomsP'
+ 'at variable near the\ntop of the function.  Also, I adde'
+ 'd a variable at the top\nof the function that determines'
+ ' whether or not TLDs should be\nchecked at all.  This is'
+ ' good if you are using this function\ninternally (i.e. i'
+ 'ntranet site) where hostnames don\'t have to \nconform to'
+ ' W3C standards and thus internal organization e-mail\nad'
+ 'dresses don\'t have to either.\nChanged some of the logic'
+ ' so that the function will work properly\nwith Netscape '
+ '6.\n\n1.1.2: Fixed a bug where trailing . in e-mail addr'
+ 'ess was passing\n(the bug is actually in the weak regexp'
+ ' engine of the browser; I\nsimplified the regexps to mak'
+ 'e it work).\n\n1.1.1: Removed restriction that countries'
+ ' must be preceded by a domain,\nso abc@host.uk is now le'
+ 'gal.  However, there\'s still the \nrestriction that an a'
+ 'ddress must end in a two or three letter\nword.\n\n1.1: '
+ 'Rewrote most of the function to conform more closely to '
+ 'RFC 822.\n\n1.0: Original  */\n// -->\n\n<!-- Begin\nfun'
+ 'ction emailCheck (emailStr) {\n\n/* The following variab'
+ 'le tells the rest of the function whether or not\nto ver'
+ 'ify that the address ends in a two-letter country or wel'
+ 'l-known\nTLD.  1 means check it, 0 means don\'t. */\n\nva'
+ 'r checkTLD=1;\n\n/* The following is the list of known T'
+ 'LDs that an e-mail address must end with. */\n\nvar know'
+ 'nDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|na'
+ 'me|coop|info|pro|museum)$/;\n\n/* The following pattern '
+ 'is used to check if the entered e-mail address\nfits the'
+ ' user@domain format.  It also is used to separate the us'
+ 'ername\nfrom the domain. */\n\nvar emailPat=/^(.+)@(.+)$'
+ '/;\n\n/* The following string represents the pattern for'
+ ' matching all special\ncharacters.  We don\'t want to all'
+ 'ow special characters in the address. \nThese characters'
+ ' include ( ) < > @ , ; : \\ " . [ ] */\n\nvar specialChar'
+ 's="\\\\(\\\\)><@,;:\\\\\\\\\\\\\\"\\\\.\\\\[\\\\]";\n\n/* The following s'
+ 'tring represents the range of characters allowed in a \n'
+ 'username or domainname.  It really states which chars ar'
+ 'en\'t allowed.*/\n\nvar validChars="\\[^\\\\s" + specialChar'
+ 's + "\\]";\n\n/* The following pattern applies if the "us'
+ 'er" is a quoted string (in\nwhich case, there are no rul'
+ 'es about which characters are allowed\nand which aren\'t;'
+ ' anything goes).  E.g. "jiminy cricket"@disney.com\nis a'
+ ' legal e-mail address. */\n\nvar quotedUser="(\\"[^\\"]*\\"'
+ ')";\n\n/* The following pattern applies for domains that'
+ ' are IP addresses,\nrather than symbolic names.  E.g. jo'
+ 'e@[123.124.233.4] is a legal\ne-mail address. NOTE: The '
+ 'square brackets are required. */\n\nvar ipDomainPat=/^\\['
+ '(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\]$/;\n\n/* Th'
+ 'e following string represents an atom (basically a serie'
+ 's of non-special characters.) */\n\nvar atom=validChars '
+ '+ \'+\';\n\n/* The following string represents one word in'
+ ' the typical username.\nFor example, in john.doe@somewhe'
+ 're.com, john and doe are words.\nBasically, a word is ei'
+ 'ther an atom or quoted string. */\n\nvar word="(" + atom'
+ ' + "|" + quotedUser + ")";\n\n// The following pattern d'
+ 'escribes the structure of the user\n\nvar userPat=new Re'
+ 'gExp("^" + word + "(\\\\." + word + ")*$");\n\n/* The foll'
+ 'owing pattern describes the structure of a normal symbol'
+ 'ic\ndomain, as opposed to ipDomainPat, shown above. */\n'
+ '\nvar domainPat=new RegExp("^" + atom + "(\\\\." + atom +"'
+ ')*$");\n\n/* Finally, let\'s start trying to figure out i'
+ 'f the supplied address is valid. */\n\n/* Begin with the'
+ ' coarse pattern to simply break up user@domain into\ndif'
+ 'ferent pieces that are easy to analyze. */\n\nvar matchA'
+ 'rray=emailStr.match(emailPat);\n\nif (matchArray==null) '
+ '{\n\n/* Too many/few @\'s or something; basically, this a'
+ 'ddress doesn\'t\neven fit the general mould of a valid e-'
+ 'mail address. */\n\nalert("Email address seems incorrect'
+ ' (check @ and .\'s)");\nreturn false;\n}\nvar user=matchA'
+ 'rray[1];\nvar domain=matchArray[2];\n\n// Start by check'
+ 'ing that only basic ASCII characters are in the strings '
+ '(0-127).\n\nfor (i=0; i<user.length; i++) {\nif (user.ch'
+ 'arCodeAt(i)>127) {\nalert("Ths username contains invalid'
+ ' characters.");\nreturn false;\n   }\n}\nfor (i=0; i<dom'
+ 'ain.length; i++) {\nif (domain.charCodeAt(i)>127) {\nale'
+ 'rt("Ths domain name contains invalid characters.");\nret'
+ 'urn false;\n   }\n}\n\n// See if "user" is valid \n\nif '
+ '(user.match(userPat)==null) {\n\n// user is not valid\n\n'
+ '\nalert("The username doesn\'t seem to be valid.");\nretur'
+ 'n false;\n}\n\n/* if the e-mail address is at an IP addr'
+ 'ess (as opposed to a symbolic\nhost name) make sure the '
+ 'IP address is valid. */\n\nvar IPArray=domain.match(ipDo'
+ 'mainPat);\nif (IPArray!=null) {\n\n// this is an IP addr'
+ 'ess\n\nfor (var i=1;i<=4;i++) {\nif (IPArray[i]>255) {\n'
+ 'alert("Destination IP address is invalid!");\nreturn fal'
+ 'se;\n   }\n}\nreturn true;\n}\n\n// Domain is symbolic n'
+ 'ame.  Check if it\'s valid.\n \nvar atomPat=new RegExp("^'
+ '" + atom + "$");\nvar domArr=domain.split(".");\nvar len'
+ '=domArr.length;\nfor (i=0;i<len;i++) {\nif (domArr[i].se'
+ 'arch(atomPat)==-1) {\nalert("The domain name does not se'
+ 'em to be valid.");\nreturn false;\n   }\n}\n\n/* domain '
+ 'name seems valid, but now make sure that it ends in a\nk'
+ 'nown top-level domain (like com, edu, gov) or a two-lett'
+ 'er word,\nrepresenting country (uk, nl), and that there\''
+ 's a hostname preceding \nthe domain or country. */\n\nif'
+ ' (checkTLD && domArr[domArr.length-1].length!=2 && \ndom'
+ 'Arr[domArr.length-1].search(knownDomsPat)==-1) {\nalert('
+ '"The address must end in a well-known domain or two lett'
+ 'er " + "country.");\nreturn false;\n}\n\n// Make sure th'
+ 'ere\'s a host name preceding the domain.\n\nif (len<2) {\n'
+ '\nalert("This address is missing a hostname!");\nreturn f'
+ 'alse;\n}\n\n// If we\'ve gotten this far, everything\'s va'
+ 'lid!\nreturn true;\n}\n\n//  End -->\n</script>\n';

// end_var_declaration
document.write(inc_validemail_js);
