var msg="" var count=1 var dtCh= "/"; var minYear=1900; var maxYear=2100; var winCust=null; var line_break = String.fromCharCode(60)+"br /"+String.fromCharCode(62); function fnPreview(page,w,h,scroll,pos,res){ if(winCust!=null){ if(!winCust.closed){ winCust.close(); } winCust=null; } if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;} if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;} else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20} settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable='+res; winCust=window.open(page,'',settings,false); winCust.creator=self; } function fnClosePreWin(){ if(winCust!=null){ if(!winCust.closed){ winCust.close(); } winCust=null; } } function checkLength(minl, maxl, stval){ if(stval.lengthmaxl){ return false; }else{ return true; } } function IsEmpty(stValue) { if ((stValue.length==0) || (stValue==null)) { return true; }else { return false; } } function validateZIP(field) { var valid = "0123456789-"; var hyphencount = 0; if (field.length!=5 && field.length!=10) { msg=msg+count+". Please enter your 5 digit or 5 digit+4 zip code.\n"; count++ return false; } for (var i=0; i < field.length; i++) { temp = "" + field.substring(i, i+1); if (temp == "-") hyphencount++; if (valid.indexOf(temp) == "-1") { msg=msg+count+". Invalid characters in your zip code.\n"; count++; return false; } if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) { msg=msg+count+". The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.\n" count++ return false; } } return true; } function isInteger(s){ var i; if(IsEmpty(s)){ return false; } for (i = 0; i < s.length; i++){ var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } return true; } function stripCharsInBag(s, bag){ var i; var returnString = ""; for (i = 0; i < s.length; i++){ var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function checknumber(nvalue){ var anum=/(^\d+$)|(^\d+\.\d+$)/ if (anum.test(nvalue)) testresult=true; else{ testresult=false; } return (testresult) } function format (expr, decplaces) { var str = "" + Math.round (eval(expr) * Math.pow(10,decplaces)) while (str.length <= decplaces) { str = "0" + str; } var decpoint = str.length - decplaces return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length); } function dollarize (expr) { return format(expr,2); } 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) { return false; } var user=matchArray[1]; var domain=matchArray[2]; for (i=0; i127) { return false; }} for (i=0; i127) { return false; }} if (user.match(userPat)==null) { return false; } var IPArray=domain.match(ipDomainPat); if (IPArray!=null) { for (var i=1;i<=4;i++) { if (IPArray[i]>255) { return false; }} return true; } var atomPat=new RegExp("^" + atom + "$"); var domArr=domain.split("."); var len=domArr.length; for (i=0;i= minDigitsInIPhoneNumber); } function ValidatePhone(Phone){ if ((Phone==null)||(Phone=="")){ return false; } if (checkInternationalPhone(Phone)==false){ return false; } return true; } function isCheckedRadio(btnRadio) { for (var i=0;i1) strDay=strDay.substring(1); if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1); for (var i = 1; i <= 3; i++) { if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1); } month=parseInt(strMonth); day=parseInt(strDay); year=parseInt(strYr); if (pos1==-1 || pos2==-1){ return false; } if (strMonth.length<1 || month<1 || month>12){ return false; } if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){ return false; } if (strYear.length != 4 || year==0 || yearmaxYear){ return false; } if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){ return false; } return true; }