/*
if(document.location.pathname!='/main.asp'){
	//authAutoLogoutTimer = setTimeout("authAutoLogout()",1200000);
	authAutoLogoutTimer = setTimeout("authAutoLogout()",gintTimeOut);
}
function authAutoLogout()
{	
	alert('The system has closed your session since no input was received for ' + gstrMessage + '.\nPlease logon again.')
	viewCancel("/logon/main.asp");
}

function authResetAutoLogout()
{	
	clearTimeout(authAutoLogoutTimer);
	authAutoLogoutTimer = setTimeout("authAutoLogout()",60000);
}

function authClearAutoLogout()
{
	clearTimeout(authAutoLogoutTimer);
}
*/
function viewCancel(strUrl)
{
	location = viewDecode(strUrl);
}

function viewEncode(strIn)
{	
	return escape(strIn).replace(/\%/g,"#").replace(/\+/g,"20");
}

function viewDecode(strIn)
{
	return unescape(strIn.replace(/\#/g,"%"));
}

function viewJump(strUrl)
{	
	var check =/[\?]/;
	if (check.test(strUrl)){
		strUrl = strUrl + '&tm=' + Date.parse(Date());
	}else{
		strUrl = strUrl + '?tm=' + Date.parse(Date());	
	}
	if(gblnDirty){
		
		if (gblnAddEmployee) {
			if(confirm('Are you sure you wish to discard this new hire?'))	{
				document.location.href = viewDecode(strUrl);
			}
		} else if(gblnAddTPC) {
			if(confirm('Are you sure you wish to discard this Third Party Check?'))	{
				document.location.href = viewDecode(strUrl);
			}
		} else {
			if(!confirm('Warning! You have made changes to the data on this screen that will not be saved\nif you continue.\n\nTo save your changes before continuing, click OK now, then click Save.\n\nTo continue without saving your changes, click Cancel.'))
			{
				document.location.href = viewDecode(strUrl);
			}
		}
	}else{
		document.location.href = viewDecode(strUrl);
	}
}

function createLink(strUrl){
	var check =/[\?]/;
	if (check.test(strUrl)){
		strUrl = strUrl + '&tm=' + Date.parse(Date());
	}else{
		strUrl = strUrl + '?tm=' + Date.parse(Date());	
	}
	//strUrl = viewEncode(strUrl)
	//document.location.href = viewDecode(strUrl);
	document.location.href = strUrl;
	
}

function ConvertUpperCase(elementName){
	var strValue = frm.elements[elementName].value;
	if(strValue != ''){
		frm.elements[elementName].value = strValue.toUpperCase();
	}
}

function Onchange_Submit(frmName){
	var frm = document.forms[frmName];
	gblnDirty=true;
	frm.submit();
}

function focusElement(frmName,frmElement){
	var frm = document.forms[frmName];
	self.focus();
	frm.elements[frmElement].focus();
	if(frm.elements[frmElement].type=='text'){
	frm.elements[frmElement].select();
	}
}

function trim(pstrText) {
	var strResult="";
	var i=pstrText.length-1;

	for (;i >=0; i-- ) {
		if( pstrText.charAt(i) != ' ') {
			pstrText = pstrText.substring(0,i+1);
			i = -1;
		}
	}
	for (i=0; i < pstrText.length; i++) {
		if ( pstrText.charAt(i) != ' ') {
			strResult = pstrText.substring(i,pstrText.length);
			i = pstrText.length + 1;
		}
	}
	return strResult;
}

function intNonSpaces(pstrText) {
	//returns length of nonspace chrarcters
	var intStrLen=0;
	var check =/[\s]/;
	if(!check.test(pstrText)){
		for (var i=0;i < pstrText.length; i++) {
			if (pstrText.charAt(i) != ' ') {
				intStrLen++;
			}
		}
	}
	return intStrLen;
}

function isNotBlank(sText){
	// Validate blank Text fields
	var check =/[\S]/;
	return check.test(sText);
}

function IsValidDate(sDate){
	var intMonth;
	var intDate;
	var intYear;
	var check = /[^\d\/]/;
	var checkFormat =/^[\d]{1,2}[\/]{1}[\d]{1,2}[\/]{1}[\d]{4}$/;
	//return check.test(sDate);
	if(!check.test(sDate)){
		if(checkFormat.test(sDate)){
			intMonth = sDate.substring(0, sDate.indexOf('/'));
			intDate = sDate.substring(sDate.indexOf('/')+1, sDate.indexOf('/',sDate.indexOf('/')+1));
			intYear = sDate.substring(sDate.indexOf('/',sDate.indexOf('/')+1)+1);
		
			//intMonth = parseInt(intMonth);
			//intDate = parseInt(intDate);
			//intYear = parseInt(intYear);
			if((intMonth > 12)||(intDate > 31)){
				return false;
			}else if(((intMonth==4)||(intMonth==6)||(intMonth==9)||(intMonth==11))&&(intDate > 30)){
				return false;
			}else if((intMonth==2)&&(intDate > 29)){
				return false;
			}else if(intMonth==2){
				if(!LeapYear(intYear)&&(intDate == 29)){
					return false;
				}
				else if((intYear < 1900) || (intYear > 2079)){
					return false;
				}
				else if((intDate <= 0) || (intMonth <=0)){
					return false;
				}
				
			}
			//Check for valid year.Added by Raj on 11/01/2001
			else if((intYear < 1900) || (intYear > 2079)){
				return false;
			}else if(((intYear==2079)&&(intMonth==6)&&(intDate>6))||((intYear==2079)&&(intMonth>6))){
				return false;
			}
			//Check for dates like 00 and months like 00. Added by Raj on 11/01/2001
			else if((intDate <= 0) || (intMonth <=0)){
				return false;
			}
		}
	}else{
		return false;
	}
	return true;
}


function isDate(sDate){
	// Validate Date mm/dd/yy format
	var intMonth;
	var intDate;
	var intYear;
	var check =/^[\d]{1,2}[\/]{1}[\d]{1,2}[\/]{1}[\d]{4}$/;

	//return check.test(sDate);
	if(check.test(sDate)){
		intMonth = sDate.substring(0, sDate.indexOf('/'));
		intDate = sDate.substring(sDate.indexOf('/')+1, sDate.indexOf('/',sDate.indexOf('/')+1));
		intYear = sDate.substring(sDate.indexOf('/',sDate.indexOf('/')+1)+1);
		
		//intMonth = parseInt(intMonth);
		//intDate = parseInt(intDate);
		//intYear = parseInt(intYear);
		
		if((intMonth > 12)||(intDate > 31)){
			return false;
		}else if(((intMonth==4)||(intMonth==6)||(intMonth==9)||(intMonth==11))&&(intDate > 30)){
			return false;
		}else if((intMonth==2)&&(intDate > 29)){
			return false;
		}else if(intMonth==2){
			if(!LeapYear(intYear)&&(intDate == 29)){
				return false;
			}
		}
		
	}else{
		return false;
	}
	return true;
}

 function LeapYear(intYear) {
      if (intYear % 100 == 0) {
         if (intYear % 400 == 0) { return true; }
      }
      else {
         if ((intYear % 4) == 0) { return true; }
      }
     return false;
}



function IsNotNumAndDash(sValue){
	var check = /[^\d\-]/;
	return check.test(sValue);
}

function isSSN(ssn){
	//Validate SSN
	var check = /^[\d]{3}[\-]?[\d]{2}[\-]?[\d]{4}$/;
	return check.test(ssn);
}

function isEmail(email){
	//Validate Email
	check = /@[\w\-]+\./;
	checkend = /\.[a-zA-Z]{2,3}$/;
	exclude=/[^_@\-\.\w']|^[_@\.\-']|[\._\-']{2}|[@\.]{2}|(@)[^@]*\1/;
		
	if(!check.test(email)){
		return false;
	}else if(!checkend.test(email)){
		return false;
	}else if(exclude.test(email)){
		return false;
	}
	return true;
}

function isZip(zip){
	//Validate Zip
	var check = /^[\d]{5}[\-]{1}[\d]{4}$/;
	var checkshort =/^[\d]{5}$/;
	if((!check.test(zip))&&(!checkshort.test(zip))){
		return false;
	}
	return true;
}

function isPhone(phone){
	//Validate Phone
	var check = /^[\d]{3}[\-]?[\d]{3}[\-]?[\d]{4}$/;
	return check.test(phone);
}

//-----------------------------
function disableTextBox(rTextBox) {
	rTextBox.readOnly = true;
	rTextBox.className = "DisabledText";
}

function enableTextBox(rTextBox) {
	rTextBox.readOnly = false;
	rTextBox.className = "TextBox";
}
//-----------------------------

function TextSet1(Text1,strSpecialChar,strExcludeChar){
	var check = /[^\w\+\&\$\*\(\)\-\#@',\.\;\:\/=~\s]/;
	if(strSpecialChar!=''){
		var SpecialChar = new RegExp("[" + strSpecialChar + "]","g");
		var strTemp = Text1.replace(SpecialChar,'');
	}else{
		var strTemp = Text1;
	}
	if(strExcludeChar!=''){
		var ExcludeChar = new RegExp("[" + strExcludeChar + "]","g");
		if(ExcludeChar.test(strTemp)){
			return false;
		}
	}
	//alert(ExcludeChar.test(strTemp));
	if (check.test(strTemp))
		{return false;
	}else{
		return true;
	}
	
}

/*
function TextSet1(Text1){
	//var val = document.frm.text1.value;
	var check = /[^\w\+\&\$\*\(\)\-\#@'\/=~\s]/;
	//var exclude=/[\s]{2,}/;
	//if ((check.test(Text1))||(exclude.test(Text1)))
	if (check.test(Text1))
		{return false;
	}else{
		return true;
	}
	
}
*/
function TextSet4(Text4,strSpecialChar){
	//var val = document.frm.text1.value;
	var check = /[^\w`'\-\.~!@#\$%^&\(\)_\{\}]/;
	if(strSpecialChar!=''){
		var SpecialChar = new RegExp("[" + strSpecialChar + "]","g");
		var strTemp = Text4.replace(SpecialChar,'');
	}else{
		var strTemp = Text4;
	}
	if (check.test(strTemp))
		{return false;
	}else{
		return true;
	}
	
}

function TextSet2(Text2,strSpecialChar)
{
	//var val = document.frm.text1.value;
	var check = /[^\w\-]/;
	if(strSpecialChar!=''){
		var SpecialChar = new RegExp("[" + strSpecialChar + "]","g");
		var strTemp = Text2.replace(SpecialChar,'');
	}else{
		var strTemp = Text2;
	}
	if (check.test(strTemp))
		{return false;
	}else{
		return true;
	}
	
}

function TextSet3(Text3,strSpecialChar,strExcludeChar)
{
	//var val = document.frm.text1.value;
	var check = /[^\w]/;
	if(strSpecialChar!=''){
		var SpecialChar = new RegExp("[" + strSpecialChar + "]","g");
		var strTemp = Text3.replace(SpecialChar,'');
	}else{
		var strTemp = Text3;
	}
	
	if(strExcludeChar!=''){
		var ExcludeChar = new RegExp("[" + strExcludeChar + "]","g");
		if(ExcludeChar.test(strTemp)){
			return false;
		}
	}
	
	if (check.test(strTemp))
		{return false;
	}else{
		return true;
	}
	
}

/*
function TextSet3(Text3,strSpecialChar)
{
	//var val = document.frm.text1.value;
	var check = /[^\w]/;
	if(strSpecialChar!=''){
		var SpecialChar = new RegExp("[" + strSpecialChar + "]","g");
		var strTemp = Text3.replace(SpecialChar,'');
	}else{
		var strTemp = Text3;
	}
	if (check.test(strTemp))
		{return false;
	}else{
		return true;
	}
	
}
*/

function validateForm(elementArray,frmName){
	var strName;
	var strValue;
	var strDataType
	var strLength
	var strError='';
	var bEntered=true;
	var frm = document.forms[frmName];
	var iArrLen;
	var strSpecialChar;
	var strExcludeChar;
	var iMax;
	var iMin;
	var iDecPlaces;
	var blnNumber;
	var blnAllowTrim;
	
	iArrLen = elementArray.length;
	for(var i=0;i < iArrLen ;i++){
		blnNumber=true;
		strName = elementArray[i][1];	
		strDataType = elementArray[i][2].toUpperCase();
		strLength = elementArray[i][3];	
		strSpecialChar = elementArray[i][4];
		if(typeof(strSpecialChar)=="undefined") strSpecialChar='';
		strExcludeChar = elementArray[i][5];	
		if(typeof(strExcludeChar)=="undefined") strExcludeChar='';
		
		//Check if form element is text or combo
		if(strDataType == "COMBO"){
			var ind = frm.elements[elementArray[i][0]].selectedIndex;
			strValue = frm.elements[elementArray[i][0]].options[ind].value;
		}else if(strDataType == "RADIO"){
			var intRadioLength = document.frm.elements[elementArray[i][0]].length;
			strValue = '';
			for(var j=0; j < intRadioLength ;j++){
				if(document.frm.elements[elementArray[i][0]][j].checked){
					strValue = document.frm.elements[elementArray[i][0]][j].value
				}
			}
			
		}else if( (strDataType == "NUMERIC") || (strDataType == "MONEY") ) {
			if(strSpecialChar!=''){
				var arrTemp = strSpecialChar.split(',',3)
				iMin = arrTemp[0];
				if(typeof(iMin)=="undefined") iMin='';
				iMax = arrTemp[1];
				if(typeof(iMax)=="undefined") iMax='';
				iDecPlaces = arrTemp[2];
				if(typeof(iDecPlaces)=="undefined") iDecPlaces='';
				
			}else{
			
				iMin='';
				iMax='';
				iDecPlaces='';
			}
			if(strExcludeChar!=''){
				if(strExcludeChar=='1')
				{
					blnAllowTrim = true;
				}
				else
				{
					blnAllowTrim = false;
				}
			
			}
			else
			{
				blnAllowTrim = false;
			}
			
			strValue = frm.elements[elementArray[i][0]].value;
			
			if(blnAllowTrim){
				strValue = trim(strValue)
			}
		}else{
			strValue = frm.elements[elementArray[i][0]].value;
		}
		
		//CHECK DATA TYPE
		switch (strDataType){
			case "TEXT" :
				if(strLength > 0){
					if(!isNotBlank(strValue)){
						strError = strError + strName + " is required.\n";
						bEntered=false;
					}else if((trim(strValue)).length < strLength){
							strError = strError + strName + " must be " + strLength + " characters.\n";
							bEntered=false;
					}
				}
				break
			
			case "TEXTNOSPACE" :
				if(strLength > 0){
					if(!isNotBlank(strValue)){
						strError = strError + strName + " is required.\n";
						bEntered=false;
					}else if(intNonSpaces(strValue) < strLength){
							strError = strError + strName + " must be " + strLength + " characters with no spaces.\n";
							bEntered=false;
					}
				}
				break
			
			case "MONEY" :
				var reMoney;
				reMoney = new RegExp("[$,/]","g");
				strValue = strValue.replace(reMoney,"");
				frm.elements[elementArray[i][0]].value = strValue;
			case "NUMERIC" :
				var iDecValue = "";
				var intDotPos = strValue.indexOf(".");
				
				if (intDotPos >= 0){	
					iDecValue = strValue.substring(intDotPos+1)
				}
				
				if(strLength > 0){
					//if required
					if (!isNotBlank(strValue)) {
						strError = strError + strName + " is required.\n";
						bEntered=false;
						blnNumber=false;
					}else if (isNaN(strValue) == true){
						strError = strError + strName + " must be entered as a number.\n";
						bEntered=false;
						blnNumber=false;
					}else if(intNonSpaces(strValue) < strLength) {
						strError = strError + strName + " must be entered as a number.\n";
						//strError = strError + strName + " must be " + strLength + " characters.\n";
						bEntered=false;
						blnNumber=false;
					}
				}else{
					//if not required 
					if((strValue != '')&&(isNaN(strValue) == true)) {
						strError = strError + strName + " must be entered as a number or leave blank.\n";
						bEntered=false;
						blnNumber=false;
					}
					
				}	
				////
				if((blnNumber)&&(iDecPlaces!='')){
						//if((iDecPlaces == 0)&&(intDotPos>=0)){
						if((iDecPlaces == 0)){
							if((iMin!= '')&&(iMax!='')) {
									if((parseFloat(strValue) < parseFloat(iMin))||(parseFloat(strValue) > parseFloat(iMax))||(intDotPos>=0)){
										strError = strError + strName + " must be a whole number between " + iMin + " and " + iMax + ".\n";
										bEntered=false;
										blnNumber=false;
									}
							}else if(iMin!= ''){
									if((parseFloat(strValue) < parseFloat(iMin))||(intDotPos>=0)||(intDotPos>=0)){
										strError = strError + strName + " must be a whole number greater than " + iMin + ".\n";
										bEntered=false;
										blnNumber=false;
									}
							}else if(iMax!= ''){
									if(parseFloat(strValue) > parseFloat(iMax)||(intDotPos>=0)){
										strError = strError + strName + " must be a whole number less than " + iMax + ".\n";
										bEntered=false;
										blnNumber=false;
									}
							}else if(intDotPos>=0){
									strError = strError + strName + " must be a whole number.\n";
									bEntered=false;
							
							}
														
												
						}else if(iDecPlaces!=''){
							if((iMin!= '')&&(iMax!='')) {
								if((parseFloat(strValue) < parseFloat(iMin))||(parseFloat(strValue) > parseFloat(iMax))||(iDecValue.length > iDecPlaces)){
									strError = strError + strName + " must be between " + iMin + " and " + iMax + " and can have " + iDecPlaces + " decimal places.\n";
									bEntered=false;
									blnNumber=false;
								}
							}else if(iMin!= ''){
								if((parseFloat(strValue) < parseFloat(iMin))||(iDecValue.length > iDecPlaces)){
									strError = strError + strName + " must be greater than " + iMin + " and can have " + iDecPlaces + " decimal places.\n";
									bEntered=false;
									blnNumber=false;
								}
							}else if(iMax!= ''){
								if(parseFloat(strValue) > parseFloat(iMax)||(iDecValue.length > iDecPlaces)){
									strError = strError + strName + " must be less than " + iMax + " and can have " + iDecPlaces + " decimal places.\n";
									bEntered=false;
									blnNumber=false;
								}
							}else if(iDecValue.length > iDecPlaces){
									strError = strError + strName + " can have " + iDecPlaces + " decimal places.\n";
									bEntered=false;
									blnNumber=false;
							}
								
						}
				}else{
					if((iMin!= '')&&(iMax!='')) {
						if((parseFloat(strValue) < parseFloat(iMin))||(parseFloat(strValue) > parseFloat(iMax))){
							strError = strError + strName + " must be between " + iMin + " and " + iMax + ".\n";
							bEntered=false;
							blnNumber=false;
						}
					}else if(iMin!= ''){
						if(parseFloat(strValue) < parseFloat(iMin)){
							strError = strError + strName + " must be greater than " + iMin + ".\n";
							bEntered=false;
							blnNumber=false;
						}
					}else if(iMax!= ''){
						if(parseFloat(strValue) > parseFloat(iMax)){
							strError = strError + strName + " must be less than " + iMax + ".\n";
							bEntered=false;
							blnNumber=false;
						}
					}
							
				}
				
				////
				/*
				if((blnNumber)&&(strValue != '')){	
					if((typeof(iMin)!= "undefined")&&(typeof(iMax)!="undefined")) {
						if((parseFloat(strValue) < parseFloat(iMin))||(parseFloat(strValue) > parseFloat(iMax))){
							strError = strError + strName + " must be in the range " + iMin + " to " + iMax + ".\n";
							bEntered=false;
							blnNumber=false;
						}
					}else if(typeof(iMin)!= "undefined"){
						if(parseFloat(strValue) < parseFloat(iMin)){
							strError = strError + strName + " must be greater than " + iMin + ".\n";
							bEntered=false;
							blnNumber=false;
						}
					}else if(typeof(iMax)!= "undefined"){
						if(parseFloat(strValue) > parseFloat(iMax)){
							strError = strError + strName + " must be less than " + iMax + ".\n";
							bEntered=false;
							blnNumber=false;
						}
					}
									
					if((blnNumber)&&(iDecPlaces!='')){
						
						if((iDecPlaces == 0)&&(intDotPos>=0)){
							strError = strError + strName + " must be a whole number.\n";
							bEntered=false;
						}else if(iDecValue!=''){
							if(iDecValue.length > iDecPlaces){
							strError = strError + strName + " only " + iDecPlaces + " decimal places are allowed..\n";
							bEntered=false;
							}
						}
					}
				}
				
				*/
				break
			
			case "DATE" :
				if(strLength > 0){
					if(!isNotBlank(strValue)){
						strError = strError + strName + " is required.\n";
						bEntered=false;
					}else if(!IsValidDate(strValue)){
						strError = strError + strName + " is invalid.\n";
						bEntered=false;
					}else if(!isDate(strValue)){
							strError = strError + strName + " must be entered in mm/dd/yyyy format.\n";
							//strError = strError + strName + " is invalid.\n";
							bEntered=false;
					}
				}else if((isNotBlank(strValue))&&(!IsValidDate(strValue))){
						strError = strError + strName + " is invalid.\n";
						bEntered=false;
				}else if((isNotBlank(strValue))&&(!isDate(strValue))){
						strError = strError + strName + " must be entered in mm/dd/yyyy format or leave blank.\n";
						bEntered=false;
					}
				break
			
			case "SSN" :
				if(strLength > 0){
					if(!isNotBlank(strValue)){
						strError = strError + strName + " is required.\n";
						bEntered=false;
					}else if(IsNotNumAndDash(strValue)){
						strError = strError + strName + " must be entered as a number.\n";
						bEntered=false;
					}else if(!isSSN(strValue)){
							strError = strError + strName + " must be entered in 999-99-9999 or 999999999 format.\n";
							//strError = strError + strName + " is invalid.\n";
							bEntered=false;
					}
				}else if(IsNotNumAndDash(strValue)){
						strError = strError + strName + " must be entered as a number or leave blank.\n";
						bEntered=false;
				}else if((isNotBlank(strValue))&&(!isSSN(strValue))){
						strError = strError + strName + " must be entered in 999-99-9999 or 999999999 format or leave blank.\n";
						//strError = strError + strName + " is invalid.\n";
						bEntered=false;
				}
				break
			
			case "EMAIL" :
				if(strLength > 0){
					if(!isNotBlank(strValue)){
						strError = strError + strName + " is required.\n";
						bEntered=false;
					}else if(!isEmail(strValue)){
							strError = strError + strName + " must be entered in the format abc@def.com.\n";
							//strError = strError + strName + " is invalid.\n";
							bEntered=false;
					}
				}else if((isNotBlank(strValue))&&(!isEmail(strValue))){
						strError = strError + strName + " must be entered in the format abc@def.com or leave blank.\n";
						bEntered=false;
				}
				break
			
			case "ZIP" :
				if(strLength > 0){
					if(!isNotBlank(strValue)){
						strError = strError + strName + " is required.\n";
						bEntered=false;
					}else if(IsNotNumAndDash(strValue)){
						strError = strError + strName + " must be entered as a number.\n";
						bEntered=false;
					}else if(!isZip(strValue)){
							strError = strError + strName + " must be in the format 99999 or 99999-9999.\n";
							bEntered=false;
					}
				}else if(IsNotNumAndDash(strValue)){
						strError = strError + strName + " must be entered as a number.\n";
						bEntered=false;
				}else if((isNotBlank(strValue))&&(!isZip(strValue))){
						strError = strError + strName + " must be in the format 99999 or 99999-9999 or leave blank.\n";
						bEntered=false;
				}
				break
				
			case "COMBO" :
				if((strLength > 0)&&(!isNotBlank(strValue))){
					strError = strError + strName + " is required.\n";
					bEntered=false;
				}
				break
				
			case "COMBONOZERO" :
				if((strLength > 0)&&( (!isNotBlank(strValue)) || (strValue == "0")) ){
					strError = strError + strName + " is required.\n";
					bEntered=false;
				}
				break
			case "RADIO" :
				if((strLength > 0)&&(!isNotBlank(strValue))){
					strError = strError + strName + " is required.\n";
					bEntered=false;
				}
				break
			case "TEXT1" :
				if(strLength > 0){
					if(!isNotBlank(strValue)){
						strError = strError + strName + " is required.\n";
						bEntered=false;
					}else if((strValue).length < strLength){
							strError = strError + strName + " must be " + strLength + " characters.\n";
							bEntered=false;
					}else if (!TextSet1(strValue,strSpecialChar,strExcludeChar)){
						strError = strError + strName + " contains invalid characters.\n";
						bEntered=false;
					}		
				}else if((isNotBlank(strValue))&&(!TextSet1(strValue,strSpecialChar,strExcludeChar))){
						strError = strError + strName + " must contain valid characters or leave blank.\n";
						bEntered=false;
					}
				break
				
			case "TEXT2" :
				if(strLength > 0){
					if(!isNotBlank(strValue)){
						strError = strError + strName + " is required.\n";
						bEntered=false;
					}else if((trim(strValue)).length < strLength){
							strError = strError + strName + " must be " + strLength + " characters.\n";
							bEntered=false;
					}else if (!TextSet2(strValue,strSpecialChar)){
						strError = strError + strName + " contains invalid characters.\n";
						bEntered=false;
					}		
				}else if((isNotBlank(strValue))&&(!TextSet2(strValue,strSpecialChar))){
						strError = strError + strName + " must contain valid characters or leave blank.\n";
						bEntered=false;
					}
				break
			
			case "TEXT3" :
				if(strLength > 0){
					if(!isNotBlank(strValue)){
						strError = strError + strName + " is required.\n";
						bEntered=false;
					}else if((trim(strValue)).length < strLength){
							strError = strError + strName + " must be " + strLength + " characters.\n";
							bEntered=false;
					}else if (!TextSet3(strValue,strSpecialChar,strExcludeChar)){
						strError = strError + strName + " contains invalid characters.\n";
						bEntered=false;
					}		
				}else if((isNotBlank(strValue))&&(!TextSet3(strValue,strSpecialChar,strExcludeChar))){
						strError = strError + strName + " must contain valid characters or leave blank.\n";
						bEntered=false;
					}
				break
				
			case "TEXT4" :
				if(strLength > 0){
					if(!isNotBlank(strValue)){
						strError = strError + strName + " is required.\n";
						bEntered=false;
					}else if((trim(strValue)).length < strLength){
							strError = strError + strName + " must be " + strLength + " characters.\n";
							bEntered=false;
					}else if (!TextSet4(strValue,strSpecialChar)){
						strError = strError + strName + " contains invalid characters.\n";
						bEntered=false;
					}		
				}
				break
			case "PHONE" :
				if(strLength > 0){
					if(!isNotBlank(strValue)){
						strError = strError + strName + " is required.\n";
						bEntered=false;
					}else if(IsNotNumAndDash(strValue)){
						strError = strError + strName + " must be entered as a number.\n";
						bEntered=false;
					}else if(!isPhone(strValue)){
						strError = strError + strName + " must be in the format 111-111-1111.\n";
						bEntered=false;
					}
				}else if(IsNotNumAndDash(strValue)){
						strError = strError + strName + " must be entered as a number.\n";
						bEntered=false;
				}else if((isNotBlank(strValue))&&(!isPhone(strValue))){
						strError = strError + strName + " must be in the format 111-111-1111 or leave blank.\n";
						bEntered=false;
				}
				break
		}		
		strDataType='';
		strName='';
	}
	if(!bEntered) {
		alert(strError);
		return false;
	}
	return true;
}


//Please do not comment this function
/*This function is used to check whether the given input is a number and whether it meets all
the necessary criteria that are mentioned as input parameters to the function.
Input parameters-- 
Number--> The required number which needs to be checked for validity.
MinValue--> The minimum value that the number should be.
MaxValue--> The maximum value that the number should be.
DecimalValue--> Number of decimal places allowed for the number (0 is allowed)
Returns an error message if there are errors or returns a blank string.*/


function IsValidNumber(Number,MinValue,MaxValue,DecimalValue,intReq) 
{
	var intDotPos,strDecValue,strNumber,strErrMessage
	strErrMessage=""
	strDecimalValue=0
	intDotPos=""
	strNumber=""
	strDecValue=new String()
	var MinValue = new String(MinValue)
	var MaxValue = new String(MaxValue)
	
	
	strNumber = new String(Number)
	intDotPos = strNumber.indexOf(".")
	if(intDotPos >= 0)
	{
		strDecValue = strNumber.substring(intDotPos+1)
	}
	
	if(typeof(intReq)=="undefined") intReq=1;
	
	//alert('Number ' + Number + ':intDotPos ' + intDotPos + ':strDecValue ' + strDecValue )
	if(isNaN(Number))
	{	
		if(intReq==0){
			strErrMessage = strErrMessage + " must be entered as a number or leave blank. \n"
		}else{
			strErrMessage = strErrMessage + " must be entered as a number. \n"
		}
	}
	else
	{
		if (DecimalValue == 0)
		{
			if((MinValue!= '')&&(MaxValue!='')) 
			{
				if((parseFloat(strNumber) < parseFloat(MinValue))||(parseFloat(strNumber) > parseFloat(MaxValue))||(intDotPos>=0))
				{
					strErrMessage = strErrMessage + " must be a whole number between " + MinValue + " and " + MaxValue + ".\n";
					
				}
			}
			else if(MinValue!= '')
			{
				if((parseFloat(strNumber) < parseFloat(MinValue))||(intDotPos>=0)||(intDotPos>=0))
				{
					strErrMessage = strErrMessage + " must be a whole number greater than " + MinValue + ".\n";
					
				}
			}
			else if(MaxValue!= '')
			{
				if(parseFloat(strNumber) > parseFloat(MaxValue)||(intDotPos>=0))
				{
					strErrMessage = strErrMessage +  " must be a whole number less than " + MaxValue + ".\n";
					
				}
			}
			else if(intDotPos>=0)
			{
				strErrMessage = strErrMessage +  " must be a whole number.\n";
				
			}
		}
		else if(DecimalValue != '')
		{//alert('elseif' + MinValue + "--" + MaxValue + "---Eval " + eval(MinValue != ''))
			
			
			if((MinValue != '')&&(MaxValue !=''))
			{//alert('Max')
				if((parseFloat(strNumber) < parseFloat(MinValue))||(parseFloat(strNumber) > parseFloat(MaxValue))||(strDecValue.length > DecimalValue))
				{
					strErrMessage = strErrMessage + " must be between " + MinValue + " and " + MaxValue + " and can have " + DecimalValue + " decimal places.\n";
					
				}
			}
			else if(MinValue!= '')
			{
				if((parseFloat(strNumber) < parseFloat(MinValue))||(strDecValue.length > DecimalValue))
				{
					strErrMessage = strErrMessage + " must be greater than " + MinValue + " and can have " + DecimalValue + " decimal places.\n";
					
				}
			}
			else if(MaxValue!= '')
			{
				if(parseFloat(strNumber) > parseFloat(MaxValue)||(strDecValue.length > DecimalValue))
				{
					strErrMessage = strErrMessage + " must be less than " + MaxValue + " and can have " + DecimalValue + " decimal places.\n";
					
				}
			}
			else if(strDecValue.length > DecimalValue)
			{
				strErrMessage = strErrMessage + " can have " + DecimalValue + " decimal places.\n";
				
			}
		}
		else
		{//alert('else')
			if((MinValue!= '')&&(MaxValue!=''))
			{
				if((parseFloat(strNumber) < parseFloat(MinValue))||(parseFloat(strNumber) > parseFloat(MaxValue)))
				{
					strErrMessage = strErrMessage + " must be between " + MinValue + " and " + MaxValue + ".\n";
					
				}
			}
			else if(MinValue!= '')
			{
				if(parseFloat(strNumber) < parseFloat(MinValue))
				{
					strErrMessage = strErrMessage + " must be greater than " + MinValue + ".\n";
				}
			}
			else if(MaxValue!= '')
			{
				if(parseFloat(strNumber) > parseFloat(MaxValue))
				{
					strErrMessage = strErrMessage + " must be less than " + MaxValue + ".\n";
					
				}
			}
		}
	}
	
		return strErrMessage
	
}

/**********************************************************************
Mod10 Validate:
This function is used to validate any bank's routing number and confirms whether
it passes the mod10 check. For example '231372691' is a valid routing number that
passed the Mod10 check.Details about the Mod10 check can be found in the Spec key
under the glossary section.
Input Parameter: The number that needs to be validated.
Output: A message that says the given number is valid or not. A blank message
indicates that the given number is valid and had passed the Mod10 check. Otherwise
an Error message will be returned.
**********************************************************************/
function Mod10Validate(Number)
{
	var strErrMessage = ""
	var T1, T2, T3, T4, T5, T6, T7, T8, T9
	var strNumber = new String(Number)
		if((strNumber.length < 9) ||(strNumber.length > 9))
		{
			strErrMessage = strErrMessage + "is invalid.";
		}
		else
		{
			var intR1, intR2
			T1 = strNumber.charAt(0);
			T2 = strNumber.charAt(1);
			T3 = strNumber.charAt(2);
			T4 = strNumber.charAt(3);
			T5 = strNumber.charAt(4);
			T6 = strNumber.charAt(5);
			T7 = strNumber.charAt(6);
			T8 = strNumber.charAt(7);
			T9 = strNumber.charAt(8);
			intR1 = parseInt((9 + (parseInt(parseInt(T1*3) + parseInt(T2*7) + parseInt(T3*1) + parseInt(T4*3) + parseInt(T5*7) + parseInt(T6*1) + parseInt(T7*3) + parseInt(T8*7))))/10) * 10
			intR2 = parseInt(parseInt(T1*3) + parseInt(T2*7) + parseInt(T3*1) + parseInt(T4*3) + parseInt(T5*7) + parseInt(T6*1) + parseInt(T7*3) + parseInt(T8*7))
									
			if(!((parseInt(intR1) - parseInt(intR2)) == parseInt(T9)))
			{
				strErrMessage = strErrMessage + "is invalid.";
			}
					
					
		}
		return strErrMessage;
			
}
		
