// JavaScript Document
function isBlank(val)
{
	if(val==null){return true;}
	for(var i=0;i<val.length;i++) {
		if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}
	}
	return true;
}
	
function isInteger(val)
{
	if (isBlank(val)){return false;}
	for(var i=0;i<val.length;i++){
		if(!isDigit(val.charAt(i))){return false;}
	}
	return true;
}
function isDecimal(val)	
{
	var DecimalFound;
	DecimalFound = false;
	
	if (isBlank(val)){val = 0;}
	for(var i=0;i<val.length;i++){
		if(!isDigit(val.charAt(i)))
		{
			if (DecimalFound == false)
			{
				if (!isDecimalPoint(val.charAt(i)))
				{
					return false;
				}
				else
				{
					DecimalFound = true;
				}
			}
			else
			{
				return false;
			}
		}
	}
	return true;
}
function isDigit(num) 
{
	if (num.length>1){return false;}
	var string="1234567890";
	if (string.indexOf(num)!=-1){return true;}
	return false;
}
function isDecimalPoint(num) 
{
	if (num.length>1){return false;}
	var string=".";
	if (string.indexOf(num)!=-1){return true;}
	return false;
}
function display_error(msg)
{
	alert_msg ="_______________________________________________________________\n";
	alert_msg += "The form has not been submitted because there are problem(s) with the form.\n";
	alert_msg += "Please correct the problem(s) and re-submit the form.\n";
	alert_msg +="_______________________________________________________________\n\n";
	alert_msg += "The following field(s) need to be corrected:-\n";
	
	msg += alert(alert_msg + msg + "\n\n");
}