<!--

function checktext(str,errmsg)
{
	var checkspc=1;
	if(str.value.length==0)
	{
		alert('you have not entered '+errmsg);
		str.focus();
		return false;
	}
	for(i=0;i<str.value.length;i++)
		if(str.value.charAt(i)  != " ")
		{
			checkspc=0; break;
		}
	if(checkspc==1)	
	{
		alert('you have not entered '+errmsg);
		str.select();
		str.focus();
		return false;
	} 
	return true;
}
function checkspace(str,errmsg)
{
	if(str.value.length==0)
	{
		alert('you have not entered '+errmsg);
		str.focus();
		return false;
	}
	for(i=0;i<str.value.length;i++)
		if(str.value.charAt(i) == " ")
		{
			alert('Please do not enter spaces in field '+errmsg);
			str.select();
			str.focus();
			return false;
		}
	return true;
}
function checkdigit(str,errmsg)
{
	digits = "0123456789";

	if (str.value.length==0) 
	{
		alert('You have not entered '+errmsg);
		str.focus();
		return false;
	}
	for (var i = 0; i < str.value.length; i++) 
	{
		var ch = str.value.charAt(i);
		var a = digits.indexOf(ch);
		if (a == -1)
		{
			alert('Invalid '+errmsg);
			str.select();
			str.focus();
			return (false);
		}
	}
	return(true);
}
function checknum(str,errmsg)
{
	if(str.value.length==0)
	{
		alert('you have not entered '+errmsg);
		str.focus();
		return false;
	}
	if(isNaN(str.value))
	{
		alert(errmsg+' must be numeric');
		str.select();
		str.focus();
		return false;
	}
	return true;
}
function checkmail(str,errmsg)
{
	flag=0;
	if(str.value.length==0)
	{
		alert('you have not entered '+errmsg);
		str.focus();
		return false;
	}
	if(str.value.indexOf("@") < 1)
	 {
		flag=1;
	 }
	else if(str.value.indexOf(".") < 1)
	 {
  		flag=1;
	 }
	else if(str.value.indexOf(" ") != -1)
	 {
   		flag=1;
	 } 
	//else if(str.value.indexOf("@")+1 >= str.value.indexOf("."))
//	 {
//		flag=1;
//	 } 
		else if(str.value.indexOf(".") == str.value.length-1)
	 {
   		flag=1;
	 } 
	 if (flag==1)
	 {
		alert('Invalid '+errmsg);
		str.select();
		str.focus();
		return false;
 	 }  
	 return true;
}
function checkpass(str1,errmsg1,str2,errmsg2)
{
	if ( str1.value != str2.value )
	{
		alert('You have entered different values in '+errmsg1);
		str1.select();
		str1.focus();
		return false;
	}	
	return true;
}
function checkcombo(str,errmsg)
{
	if(str.selectedIndex <=0 )
	{
		alert('you have not selected '+errmsg);
		str.focus();
		return false;
	}
	return true;
}
function checkint(str,errmsg)
{
	if( str.value>2147483647 || str.value<0 )
	{
		alert('Invalid '+errmsg);
		str.select();
		str.focus();
		return false;
	}
	return true;
}
function checkdecimal(str,Pre,Scal,errmsg)
{
	digits = "0123456789.";
	var d;
	d=str.value.indexOf(".");
	if (Pre < d)
	{
		alert('Invalid '+errmsg);
		str.focus();
		return false;
	}
	if ((str.value.length-(d+1+Scal)) >0)
	{
		alert('Invalid '+errmsg);
		str.focus();
		return false;
	}
	if (str.value.length==0) 
	{
		alert('You have not entered '+errmsg);
		str.focus();
		return false;
	}
	for (var i = 0; i < str.value.length; i++) 
	{
		var ch = str.value.charAt(i);
		var a = digits.indexOf(ch);
		if (a == -1)
		{
			alert('Invalid '+errmsg);
			str.select();
			str.focus();
			return (false);
		}
	}
	return(true);
}

function checkmob(str,errmsg)
{
	digits = "0123456789+() ";

	if (str.value.length==0) 
	{
		alert('You have not entered '+errmsg);
		str.focus();
		return false;
	}
	for (var i = 0; i < str.value.length; i++) 
	{
		var ch = str.value.charAt(i);
		var a = digits.indexOf(ch);
		if (a == -1)
		{
			alert('Invalid '+errmsg);
			str.select();
			str.focus();
			return (false);
		}
	}
	return(true);
}
	/**************************************************************
			IsNumber: Returns a Boolean value indicating whether an 
					expression can be evaluated as a number (this
					includes values like $15,656.00)
			Parameters:
				Expression = Variant containing a numeric expression or 
							string expression.
			Returns: Boolean
			***************************************************************/
			function IsNumber(Expression)
			{
				Expression = Expression.toLowerCase();
				RefString = "0123456789.-";

				if (Expression.length < 1) 
					return (false);

				for (var i = 0; i < Expression.length; i++) 
				{
					var ch = Expression.substr(i, 1)
					var a = RefString.indexOf(ch, 0)
					if (a == -1)
						return (false);
				}
				return(true);
			}

	
	/**************************************************************
		IsDate: Returns a Boolean (true) if the date is true, false	is not
		Parameters:
			- DateStr: String date in format (MM/DD/YYYY)
		Returns: Boolean
		***************************************************************/
		function IsDate(dateStr)
		{
			// Checks for the following valid date formats:
			// MM/DD/YYYY   MM-DD-YYYY

			var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

			var matchArray = dateStr.match(datePat)
			if (matchArray == null)
				return false

			month = matchArray[1]
			day = matchArray[3]
			year = matchArray[4]
			if (month < 1 || month > 12)
				return false

			if (day < 1 || day > 31)
				return false

			if ((month==4 || month==6 || month==9 || month==11) && day==31)
				return false

			if (month == 2)
			{
				var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
				if (day>29 || (day==29 && !isleap))
					return false;
			}
			return true;
		}

// -->