	function ChkEmpty(fld,Name)
	{
		if  ( !isNotEmpty( fld.value, Name ))
		{	return false
		}
		
	}
		
	function ChkFld( fld,Name,Type,Blank)
	{   	
		if (Blank == "B")
		{
			if  ( !isNotEmpty( fld.value, Name ))
			{	
				return false
			}
		}
		if	(Type == "F") //Numeric
		{	
			return !isNotFloat(fld.value,Name)
		}
		if (Type == "A") //Alphabets
		{
		  return !isNotAlphabets(fld.value,Name)
		}	
		else 
		{	if	(Type == "N") //Numeric
			{	return !isNotNumeric(fld.value,Name)
			}
			else
			{	if	(Type == "X") // AlphaNumeric
				{
					return !isNotAlphNumeric(fld.value,Name)
				}
				else
				{	if	(Type == "L") // Login Name Field
					{
						
						return !isNotLogin(fld.value)
					}
					else
					{
						if	(Type == "D")
						{
							return !isDate(fld.value)
						}
						else
						if	(Type == "E")
						{
							return !isNotEmailId(fld.value)
						}
						
							
					}
			 }
		  }	 	
		}
		return true			 
	}

function isNotEmpty(field, name)
	{
		if (field =="")
		{
			alert("The " + name + " field is empty. Please enter the " + name + 			".");
			return false;
		}
		
		for (var i=0;i < field.length;i++)
		{
			if (field.substring(i,i+1) != " ")
			{
			  return true
			}
		}
		alert("The " + name + " field is empty. Please enter the " + name + "." );
		return false
	}


function isNotAlphabets(str,Name)
{		
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && (ch !=' ')) 
		{
			alert("The " + Name + " accepts only letters.Please re-enter " + Name + ".");
			return true;
		}
	}
	return false;
}


function isNotNumeric(str,Name)
{
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if((ch < "0" || ch > "9")) 
		{
			alert("The " + Name + " accepts only numeric value.Please re-enter " + Name + ".");
			return true;
		}
	}
	return false;
}

function isNotFloat(str,Name)
{
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if((ch < "0" || ch > "9") && (ch !="-") && (ch !=' ')&& (ch !='.')) 
		{
			alert("The " + Name + " accepts only a Dot (.) and numeric value.Please re-enter " + Name + ".");
			return true;
		}
	}
	return false;
}

function isNotAlphNumeric(str,Name)
{
	
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if ( ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && (ch < "0" || "9" < ch) && (ch != '_') &&   (ch != '.') && (ch != ' ') && (ch != "'"))
		{
			alert("The " + Name + " only accepts letters,numbers & underscore.Please re-enter the " + Name + ".");
			return true;
		}
	}
	
	return false;
}
		
function isNotLogin(str)
{
	var ch = str.substring(0,1 );
	if ( ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch))  && (ch != '_')) 
	{
		alert("First character of the  field  must be letters or underscore.\n\nPlease re-enter ");
		return true;
	}
	
	return isNotAlphNumeric(str)
}

function isNotEmailId(str)
{
	var ch = str.substring(0,1 );
	if ( ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch))  && (ch != '_')) 
	{
		alert("First character of the  field  must be letters or underscore.\n\nPlease re-enter ");
		return true;
	}
	
	if ( !isNotAlphNumeric(str) )
	{	
		var flag
		flag = true
		for (var i=0;i < str.length;i++)
		{	if (str.substring(i,i+1) == "@")
			{ 	flag = false
				break
			}
		}
		if ( flag )
		{	alert("Invalid Email. Please re-enter in 'abcd@xyz.com' format ");
			return true
		}	
		
		return false
	}	
	return true
}


function isDate(dteCheck) 
{
	var intDate
	var today
	dtetoday = new Date();
	for(var intCtr=0;intCtr<=dteCheck.length-1;intCtr++)
		if(dteCheck.charAt(intCtr)=="-")
			dteCheck=dteCheck.replace(/\-/,"/");
	intDate=dteCheck.split("/") //Splits the given date as day,month,year & stores in intDate array
	//After dteCheck is split it stores in intDate as 
	// intDate[0] is the month
	// intdate[1] is the day
	// intDate[2] is the year
	//
	if (intDate[0].length > 2 || intDate[1].length > 2 || intDate[0].length < 1 || intDate[1].length < 1 || intDate[2].length != 4 )
		
		alert("in valid date enter mm/dd/yyyy");
		return false;
	
	if (intDate[2]>1850 && intDate[0]>=1 && intDate[0]<=12 && intDate[1]>=1 && intDate[1]<=DaysInMonth(intDate[0],intDate[2]))
		return true;
	else
	lert("in valid date enter mm/dd/yyyy");	
	return false;
}

function DaysInMonth(intMon,intYr)
{
	switch(parseInt(intMon))
	{
		case 2:
			if ((intYr%100)==0)
				if ((intYr%400)==0) 
					return 29;
				else
					return 28;
			else if((intYr%4)==0)
					return 29;
			else
				return 28;
			break;
		case 4:
			return 30
			break;
		case 6:
			return 30
			break;
		case 9:
			return 30
			break;
		case 11:
			return 30
			break;
		default:
			return 31;
			break;
	}
}


