function Validator(theForm)
{
	if (theForm.Name.value == "")
	{
	alert("Please enter your name.");
	theForm.Name.focus();
	return (false);
	}

	var myRegExpr = new RegExp("^([A-Z]+[ ]?|[-]?)+$","gi");
	if (!myRegExpr.test(theForm.Name.value))
	{
	    alert("Please enter only letters, spaces or hyphens in the Name field.");
	    theForm.Name.focus();
	    return (false);
	} 
  
	if (theForm.Email.value == "")
	{
	alert("Please enter a value in the Email field.");
	theForm.Email.focus();
	return (false);
	}
	
	myRegExpr.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$","gi");
	if (!myRegExpr.test(theForm.Email.value))
	{
		alert("This does not appear to be a valid email address.")
	    theForm.Email.focus();
	    return (false);
	}
	
	if (theForm.Subject.value == "")
	{
	alert("Please enter subject.");
	theForm.Subject.focus();
	return (false);
	}

	myRegExpr.compile("^([A-Z]+[ ]?|[-]?)+$","gi");
	if (!myRegExpr.test(theForm.Subject.value))
	{
	    alert("Please enter only letters, spaces, hyphens in the Subject field.");
	    theForm.Subject.focus();
	    return (false);
	}
	
	if (theForm.Comment.value == "")
	{
	alert("Please enter your message.");
	theForm.Comment.focus();
	return (false);
	}
	return (true);
}

function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else 
countfield.value = maxlimit - field.value.length;
}
