var whitespace = " \t\n\r";

function ForceEntry(val, str) 
{
	var strInput = new String(val.value);
	if (isWhitespace(strInput)) 
	{
		alert(str);
		return false;
	} 
	else
		return true;
}

function isWhitespace (s)
{
	var i; 
	if (isEmpty(s)) return true;
	for (i = 0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if (whitespace.indexOf(c) == -1) return false;
	}	
	return true;
}

function isEmpty(s)
{ 
	return ((s == null) || (s.length == 0)) 
}

function ValidateFormText(ControlToValidate, ErrorMessage) 
{
	var CanSubmit = false;	
	CanSubmit = ForceEntry(ControlToValidate, ErrorMessage);
	if (CanSubmit)
		return true;
	else {
		ControlToValidate.focus();
		return false;
	}	
}
