function emailcheck(emailStr) { var FormData=document.frm var dot=0 var at2=0 var at 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)") alert(validate_alert1); return false } var user=matchArray[1] var domain=matchArray[2] if (user.match(userPat)==null) { //alert("The username doesn't seem to be valid.") alert(validate_alert1); return false } var IPArray=domain.match(ipDomainPat) if (IPArray!=null) { for (var i=1;i<=4;i++) { if (IPArray[i]>255) { //alert("Destination IP address is invalid!") alert(validate_alert3); return false } } return true } var domainArray=domain.match(domainPat) if (domainArray==null) { //alert("The domain name doesn't seem to be valid.") alert(validate_alert4); document.frmsubscribe.txtemail.focus(); 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>3) { //alert("The address must end in a three-letter domain, or two letter country.") alert(validate_alert5); return false }*/ if (len<2) { //var errStr="This address is missing a hostname!" var errStr=validate_alert6 alert(errStr) return false } } //////////////////////////////////////////////// function trim(TRIM_VALUE){ if(TRIM_VALUE.length < 1){ return""; } TRIM_VALUE = RTrim(TRIM_VALUE); TRIM_VALUE = LTrim(TRIM_VALUE); if(TRIM_VALUE==""){ return ""; } else{ return TRIM_VALUE; } } //End Function function RTrim(VALUE){ var w_space = String.fromCharCode(32); var v_length = VALUE.length; var strTemp = ""; if(v_length < 0){ return""; } var iTemp = v_length -1; while(iTemp > -1){ if(VALUE.charAt(iTemp) == w_space){ } else{ strTemp = VALUE.substring(0,iTemp +1); break; } iTemp = iTemp-1; } //End While return strTemp; } //End Function function LTrim(VALUE){ var w_space = String.fromCharCode(32); if(v_length < 1){ return""; } var v_length = VALUE.length; var strTemp = ""; var iTemp = 0; while(iTemp < v_length){ if(VALUE.charAt(iTemp) == w_space){ } else{ strTemp = VALUE.substring(iTemp,v_length); break; } iTemp = iTemp + 1; } //End While return strTemp; } //End Function function spcharvalidate( str,allowed ) { str = str.toLowerCase(); var spChar = '\'\\~`!@#$%^&*+="{[}]:,;<>?|'; var found = false; var i=0; while ( (i < str.length) ) { var txt = str.substr(i,1) if ( spChar.indexOf(txt) != -1 && allowed.indexOf(txt)==-1 ) { found = true; break; } i++; } return found; }// end of SPChatValidate function spchemail( str,allowed ) { str = str.toLowerCase(); var spChar = '\'\\~`!#$%^&*+="{[}]:,;<>?|'; var found = false; var i=0; while ( (i < str.length) ) { var txt = str.substr(i,1) if ( spChar.indexOf(txt) != -1 && allowed.indexOf(txt)==-1 ) { found = true; break; } i++; } return found; }// end of SPChatValidate function startchar( str, notallowed) { var txt = str.substr(0,1); if(notallowed.indexOf(txt)!=-1) return true; return false; }// end of startchar function datecheck(str1,str2,str3) { var arr=new Array(36); } function check(str) { if(str.substr(0,7)!="http://") return false; return true; } function vdate(day,month,year) { var arr1= new Array(31,29,31,30,31,30,31,31,30,31,30,31); var arr2= new Array(31,28,31,30,31,30,31,31,30,31,30,31); if((year % 400)==0 || ((year % 100)!=0 &&(year % 4)==0)) { if ( arr1[month -1] >= day ) { return true; } return false; } else { if( arr2[month -1] >= day ) { return true; } return false; } } function verifyIP (IPvalue) { errorString = ""; //theName = "IPaddress"; theName = validate_alert9 var ipPattern = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/; var ipArray = IPvalue.match(ipPattern); if (IPvalue == "0.0.0.0") //errorString = errorString + theName + ': '+IPvalue+' +is a special IP address and cannot be used here.'; errorString = errorString + validate_alert9 + ': '+IPvalue+ " "+ validate_alert5; else if (IPvalue == "255.255.255.255") //errorString = errorString + theName + ': '+IPvalue+' is a special IP address and cannot be used here.'; errorString = errorString + validate_alert9 + ': '+IPvalue+ " "+ validate_alert5; if (ipArray == null) //errorString = errorString + theName + ': '+IPvalue+' is not a valid IP address.'; errorString = errorString + validate_alert9 + ': '+IPvalue+ " "+ validate_alert8; else { for (i = 0; i < 4; i++) { thisSegment = ipArray[i]; if (thisSegment > 255) { //errorString = errorString + theName + ': '+IPvalue+' is not a valid IP address.'; errorString = errorString + validate_alert9 + ': '+IPvalue+ " "+ validate_alert8; i = 4; } if ((i == 0) && (thisSegment > 255)) { //errorString = errorString + theName + ': '+IPvalue+' is a special IP address and cannot be used here.'; errorString = errorString + validate_alert9 + ': '+IPvalue+ " "+ validate_alert7; i = 4; } } } extensionLength = 3; if (errorString == "") return false; else alert (errorString); return true; } ////////////////////////////////////////////////////////////// function checkXSS(v){ var regex=/