	function IsAlpha(alphane)
	{
		var numaric = alphane;
		for(var j=0; j<numaric.length; j++)
		{
			var alphaa = numaric.charAt(j);
			var hh = alphaa.charCodeAt(0);
			if((hh > 64 && hh<91) || (hh > 96 && hh<123))
			{
			}
			else	
			{
				return false;
			}
		}
		return true;
	}


	function IsNumeric(strString)
	//  check for valid numeric strings	
	{
		var strValidChars = "0123456789.-";
		var strChar;
		var blnResult = true;

		if (strString.length == 0) return false;

		//  test strString consists of valid characters listed above
		for (i = 0; i < strString.length && blnResult == true; i++)
			{
			strChar = strString.charAt(i);
			if (strValidChars.indexOf(strChar) == -1)
				{
				blnResult = false;
				}
			}
		return blnResult;
	}

	function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		var bValid = true;
		
		if (str.indexOf(at)==-1)
			bValid = false;
		else if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
			bValid = false;
		else if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
			bValid = false;
		else if (str.indexOf(at,(lat+1))!=-1)
			bValid = false;
		else if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		    bValid = false;
		else if (str.indexOf(dot,(lat+2))==-1)
			bValid = false;		
		else if (str.indexOf(" ")!=-1)
			bValid = false;
			
		if (!bValid)
		{
		    alert("Invalid E-mail. Please correct and re-enter");
		    return false
		 }
		

 		 return true					
	}




	function checkField (sFieldName, sUIName, sTypeFlag)
	{
		bValid = true;
		ctrl = getObj2 (sFieldName)


		if (ctrl.type == "select-one")
			sVal = ctrl.options[ctrl.selectedIndex].text
		else
			sVal = ctrl.value;
		
		
		if (sVal == '')
		{
			alert ('Please supply a value for ' + sUIName);
			bValid = false;
		}		
		else if (sTypeFlag == 'n' && !IsNumeric(sVal))
		{
			alert (sUIName + ' must be a numeric value');
			bValid = false
		}		
		else if (sTypeFlag == 'a' && !IsAlpha (sVal))
		{
			alert (sUIName + ' must be an alpha based value only (i.e. a..z or A..Z)');
			bValid = false;
		}
		
		if (!bValid)
		{
			ctrl.focus();
			return false		
		}
		
		return true;
	}
