  
// check the validity of the name. returns false if the string is empty 
function checkname(formobj)
{    
	formobj.value= trimtxt(formobj);  
	if  (isBlank(formobj))
	{
		formobj.focus();
		alert("Please enter your name");
		return false;
	}
	return true;
} // end of checkname function
	
	  
// check for the validity of Email address. Only 1 '@' and atleast one '.' 
// is required in the address string. 
function checkemail(formobj)
{
	formobj.value = trimtxt(formobj);
		if (!isEmail(formobj))
		{ 
			formobj.focus();
			alert("Please enter a valid Email Address. Example - yourname@hotmail.com");
			return false;
		}
		return true;
}  // end of checkmail function
	   
// check the length of the message field 
function checkmsg(formobj)
{  
	var charlength = formobj.value.length;
  
	if  (charlength > 1000)
		{
			formobj.focus();
			alert("Your message is too long -- maximum 1000 characters. You entered " + charlength + " characters.");
			return false;
		}
	return true;
} // end of checkmsg function

	
	
	
// form level validation for all the fields. 
function checkform()
{ 
		
	if (!checkemail(document.form1.from_email)
		|| !checkname(document.form1.from_name)
		|| !checkmsg(document.form1.message)
		)
	{
		return false;
	}
	return true;
} // end of function checkform