var strAlpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";var strAlphaNew="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ '-";var strNumeric="0123456789";var strSpecialChar="@#$%-.\"'()+:[]_";var strInvalidChar="=\"~";function trimtxt(objForm){if(typeof objForm=='object')var strTemp=objForm.value;elsevar strTemp=new String(objForm);if(strTemp.search(/^\s+/)!=-1)strTemp=strTemp.substring(strTemp.search(/\S+/),strTemp.length);if(strTemp.search(/(\s+)$/)!=-1)strTemp=strTemp.substring(0,strTemp.search(/(\s+)$/));return strTemp;}function isQuotes(objForm,strLabel,iMsgId){if(typeof objForm=='object'){strTextString=objForm.value}elsestrTextString=new String(objForm)var regObj=eval("/"+strSpecialChar.charAt(6)+"/")if((regObj.test(strTextString))&&(arguments.length!=1)){switch(parseInt(iMsgId,10)){case 1:alert(strLabel+" cannot contain double quotes.");break;case 2:alert(strLabel+" can contain only alphabets, apostrophes, hyphens, spaces and dots.");break;}objForm.select();objForm.focus();}return regObj.test(strTextString)}function isName(objForm,strLabel){var bRet=true;if(typeof objForm=='object'){objForm.value=trimtxt(objForm.value)strTextString=objForm.value}elsestrTextString=new String(objForm)if(strTextString.length==0)bRet=false;if(bRet){var regObj=/[^\w\-\_\,\.\s]/for(var i=0;i<strTextString.length;i++){strTestChar=strTextString.charAt(i);if(regObj.test(strTestChar)){bRet=false;break;}}}if(!bRet)setFocus(objForm,strLabel+" can contain only alphabets, numbers, hyphen, underscores and period.\nPlease enter a valid "+strLabel+".");return bRet;}function setFocus(objFormX,strErrMessageX){objFormX.select();objFormX.focus();if(arguments.length!=1)alert(strErrMessageX);return;}function isEmail(objForm,strLabel){bRet=true;if(typeof objForm=='object'){objForm.value=trimtxt(objForm.value)strTextString=objForm.value}elsestrTextString=new String(objForm)if(strTextString.length>4){strInfo=strTextString.substring(strTextString.length-4);if(strInfo.toUpperCase()=='INFO'){strTextString=strTextString.substring(0,strTextString.length-1);}}var objReg1=eval("/[\\s]|("+strSpecialChar.charAt(0)+strSpecialChar.charAt(5)+"*"+strSpecialChar.charAt(0)+")|(\\"+strSpecialChar.charAt(5)+"\\"+strSpecialChar.charAt(5)+")|("+strSpecialChar.charAt(0)+"\\"+strSpecialChar.charAt(5)+")|(\\"+strSpecialChar.charAt(5)+strSpecialChar.charAt(0)+")|(^\\"+strSpecialChar.charAt(5)+")/")var objReg2=eval("/^"+strSpecialChar.charAt(5)+"+\\"+strSpecialChar.charAt(0)+"(\\"+strSpecialChar.charAt(12)+"?)["+strAlpha+strNumeric+"\\"+strSpecialChar.charAt(4)+"\\"+strSpecialChar.charAt(5)+"]+\\"+strSpecialChar.charAt(5)+"(["+strAlpha+"]{"+strNumeric.charAt(2)+","+strNumeric.charAt(3)+"}|["+strNumeric+"]{"+strNumeric.charAt(1)+","+strNumeric.charAt(3)+"})(\\"+strSpecialChar.charAt(13)+"?)$/")var objReg3=eval("/["+strAlpha+strNumeric+"\\"+strSpecialChar.charAt(5)+"\\"+strSpecialChar.charAt(4)+strSpecialChar.charAt(14)+"]/")if(!objReg1.test(strTextString)&& objReg2.test(strTextString)){var arrTemp=strTextString.split('@')for(var i=0;i<arrTemp[0].length;i++){strTestChar=arrTemp[0].charAt(i);if(strTestChar=="'"){if(typeof objForm=='object'){setFocus(objForm,"Please enter a valid "+strLabel+".");}else{alert("Please enter a valid "+strLabel+".")}return false;break;}if(!objReg3.test(strTestChar)){bRet=false;break;}}bRet=true;}elsebRet=false;if(!bRet){if(typeof objForm=='object'){setFocus(objForm,"Please enter a valid "+strLabel+".");}else{alert("Please enter a valid "+strLabel+".")}}return bRet;}function checkLength(objForm,iLength,strLabel){var objFormVal=trimtxt(objForm.value)if(objFormVal!=""){if(objForm.value.length>iLength){alert("The maximum characters that can be entered for "+strLabel+" is "+iLength+".\nPlease limit the entry to "+iLength+" characters.");objForm.focus();return false;}}return true;}function isTelePhone(objForm,strLabel,strErrorMessage){bRet=true;if(typeof objForm=='object'){objForm.value=trimtxt(objForm.value)strTextString=objForm.value}elsestrTextString=new String(objForm)if(strTextString.length==0)bRet=false;if(bRet){var regObj=eval("/[^"+strNumeric+"\\s"+strSpecialChar.charAt(8)+"\\"+strSpecialChar.charAt(9)+"\\"+strSpecialChar.charAt(10)+"\\"+strSpecialChar.charAt(4)+"\\,]/g")for(var i=0;i<strTextString.length;i++){strTestChar=strTextString.charAt(i);if(regObj.test(strTestChar)){bRet=false;break;}}}if(!bRet){if(strErrorMessage!=null){setFocus(objForm,strErrorMessage);}else{setFocus(objForm,"Please enter a valid "+strLabel+".");}}return bRet;}function isAlpha(objForm,strLabel,strAllowQuote){bRet=true;if(typeof objForm=='object'){objForm.value=trimtxt(objForm.value)strTextString=objForm.value}elsestrTextString=new String(objForm)if(strTextString.length==0)bRet=false;else{if(strAllowQuote=='1'){var regObj=eval("/[^"+strAlphaNew+"]/")}else{var regObj=eval("/[^"+strAlpha+"]/")}if(regObj.test(strTextString))bRet=false;}if(!bRet)setFocus(objForm,strLabel+" can contain only alphabets and space.");return bRet}function isBlank(objForm,strLabel,strErrorMessage){if(typeof objForm=='object'){objForm.value=trimtxt(objForm.value)strTextString=objForm.valueiValLength=strTextString.length}elsestrTextString=new String(objForm)if((arguments.length!=1)&&(iValLength==0)){if(strErrorMessage!=null){setFocus(objForm,strErrorMessage);}else{setFocus(objForm,strLabel+" is required.\nPlease enter a "+strLabel+".");}}return(iValLength==0)}