// (c) 2004 Ron Jourard

_bnsValidationVersion="1.00";function _isAlpha(){var str=this+"";if(str.isBlank())return false;var bRetValue=true;for(var i=0;i<str.length;i++){if(!(((str.charAt(i)>="a")&&(str.charAt(i)<="z"))||((str.charAt(i)>="A")&&(str.charAt(i)<="Z")))){bRetValue=false;break}}return bRetValue};String.prototype.isAlpha=_isAlpha;Number.prototype.isAlpha=_isAlpha;function _isAlphaNum(){var str=this+"";if(str.isBlank())return false;var bRetValue=true;for(var i=0;i<str.length;i++){if(!(((str.charAt(i)>="0")&&(str.charAt(i)<="9"))||((str.charAt(i)>="a")&&(str.charAt(i)<="z"))||((str.charAt(i)>="A")&&(str.charAt(i)<="Z")))){bRetValue=false;break}}return bRetValue};String.prototype.isAlphaNum=_isAlphaNum;Number.prototype.isAlphaNum=_isAlphaNum;function _isAlphaNumOrUnderscore(){var str=this+"";if(str.isBlank())return false;var bRetValue=true;for(var i=0;i<str.length;i++){if(!(((str.charAt(i)>="0")&&(str.charAt(i)<="9"))||((str.charAt(i)>="a")&&(str.charAt(i)<="z"))||((str.charAt(i)>="A")&&(str.charAt(i)<="Z"))||(str.charAt(i)=="_"))){bRetValue=false;break}}return bRetValue};String.prototype.isAlphaNumOrUnderscore=_isAlphaNumOrUnderscore;Number.prototype.isAlphaNumOrUnderscore=_isAlphaNumOrUnderscore;function _isBlank(){var bRetValue=false;var str=this+"";if(this.isNull()||this.isUndef(this)||(str.trim()==""))bRetValue=true;return bRetValue};String.prototype.isBlank=_isBlank;Number.prototype.isBlank=_isBlank;function _isNull(){var bRetValue=false;var val=this+"";if(val=="null")bRetValue=true;return bRetValue};String.prototype.isNull=_isNull;Number.prototype.isNull=_isNull;function _isUndef(){var bRetValue=false;var val=this+"";if(val=="undefined")bRetValue=true;return bRetValue};String.prototype.isUndef=_isUndef;Number.prototype.isUndef=_isUndef;function _isIndex(){var str=this+"";if(str.isBlank())return false;var bRetValue=true;for(var i=0;i<str.length;i++){if(!((str.charAt(i)>="0")&&(str.charAt(i)<="9"))){bRetValue=false;break}}return bRetValue};String.prototype.isIndex=_isIndex;Number.prototype.isIndex=_isIndex;function _isInt(){var str=this+"";if(str.isBlank())return false;var bRetValue=true;if(str.charAt(0)=="+"||str.charAt(0)=="-")str=str.substr(1);bRetValue=str.isIndex();return bRetValue};String.prototype.isInt=_isInt;Number.prototype.isInt=_isInt;function _isNum(){var str=this+"";if(str.isBlank())return false;var bRetValue=true;var nDecimalPoint;var sWork;if(str.charAt(0)=="+"||str.charAt(0)=="-")str=str.substr(1);nDecimalPoint=str.indexOf(".");if(nDecimalPoint!=str.lastIndexOf("."))return false;if(nDecimalPoint<0)return str.isInt();if(nDecimalPoint>0){sWork=str.substr(0,nDecimalPoint);if(!sWork.isInt())return false}if(nDecimalPoint>=0&&nDecimalPoint<str.length-1){sWork=str.substr(nDecimalPoint+1);if(!sWork.isIndex())return false}return bRetValue};String.prototype.isNum=_isNum;Number.prototype.isNum=_isNum;function _is5DigitZip(){var str=this+"";if(str.isBlank())return false;return((str.length==5)&&str.isIndex())};String.prototype.is5DigitZip=_is5DigitZip;Number.prototype.is5DigitZip=_is5DigitZip;function _trimString(str){str=this!=window?this:str;return str.replace(/^\s+/g,'').replace(/\s+$/g,'')};String.prototype.trim=_trimString;function _isCurrency(){var str=this+"";if(str.isBlank())return false;var bRetValue=false;var iDecimalPoint=(str.isNum())?str.indexOf("."):-1;bRetValue=(iDecimalPoint<0)?str.isNum():((iDecimalPoint==str.length-1)||(iDecimalPoint==str.length-3));return bRetValue};String.prototype.isCurrency=_isCurrency;Number.prototype.isCurrency=_isCurrency;function _isTime(){var str=this+"";if(str.isBlank())return false;var bRetValue=false;var iColon=str.indexOf(":");var bColon=(iColon>=0);var sHours="";var sMinutes="";var bHours=false;var bMinutes=false;if(!bColon){if(str.length>2)return false;sHours=str;sMinutes="00"}if(bColon){sHours=str.substring(0,iColon);if(sHours.length>2)return false;sMinutes=str.substring(iColon+1)}var iHours=parseInt(sHours);var iMinutes=parseInt(sMinutes);if((iHours.toString()==sHours)&&(iHours>=0)&&(iHours<=12))bHours=true;if(((iMinutes.toString()==sMinutes)||((iMinutes.toString()+"0")==sMinutes)||(("0"+iMinutes.toString())==sMinutes))&&(iMinutes>=0)&&(iMinutes<=59))bMinutes=true;return(bHours&&bMinutes)};String.prototype.isTime=_isTime;Number.prototype.isTime=_isTime;function _isEmail(){var str=this+"";if(str.isBlank())return false;var bRetValue=true;var sName=str.substring(0,str.indexOf("@"));var sDomain=str.substring(str.indexOf("@")+1,str.length);if((sName.length==0)||(sDomain.indexOf(".")<=0)||(sDomain.indexOf("@")!=-1)||(!str.charAt(str.length-1).isAlpha()))bRetValue=false;return bRetValue};String.prototype.isEmail=_isEmail;Number.prototype.isEmail=_isEmail;function _isPhone(){var str=this+"";if(str.isBlank())return false;var bRetValue=true;str=__stripNonNumeric(str);if(str.length!=10&&str.length!=7)bRetValue=false;return bRetValue};String.prototype.isPhone=_isPhone;Number.prototype.isPhone=_isPhone;function __stripNonNumeric(str){var sResult="";if(str.isBlank())return null;str+="";for(var i=0;i<str.length;i++){if((str.charAt(i)>="0")&&(str.charAt(i)<="9"))sResult=sResult+str.charAt(i)}return sResult};