
/*
Function to check the a character must be alphabet or number
Input:-
1. strFormName 
2. strFieldName 
3. lngStart
4. lngEnd 
5. lngMode - 1 is alpahbet, 2 is number
6. strErrorMessage

Output:-
Return true or false
*/

function CharacterTypeChecker(strFormName, strFieldName, lngStart, lngEnd, lngMode, strErrorMessage){
	var objForm = eval("document." + strFormName);
	var objField = eval("objForm." + strFieldName);
	var strInputVal = objField.value;
	var strInputStr = strInputVal.toString();
	var lngInputLength = strInputStr.length
	if (lngInputLength > 0){
		for (var i = lngStart - 1; i < lngEnd; i++)
		{
			var chrOneChar = strInputStr.charAt(i);
			if (lngMode == 1){
				if (!IsAlphabet(chrOneChar)){
					alert(strErrorMessage);
					return false;
				}
			}
			else if (lngMode == 2){
				if (!IsNumber(chrOneChar)){
					alert(strErrorMessage);
					return false;
				}
			}
		}
	}
	return true;
}

function IsAlphabet(chrOneChar){
	if ( ((chrOneChar >= "a") && (chrOneChar <= "z")) || ((chrOneChar >= "A") && (chrOneChar <= "Z")) ) {
		return true;
	}
	return false;
}


function IsNumber(chrOneChar){
	if (( chrOneChar >= "0") && (chrOneChar <= "9") ){
		return true;
	}
	return false;
}




