function mailVal(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, apostrophe or hyphen in the Name field.");
	    theForm.Name.focus();
	    return (false);
	}
  
	if (theForm.EmailAddr.value == "")
	{
		alert("Please enter a value in the Email field.");
		theForm.EmailAddr.focus();
		return (false);
	}
  
	myRegExpr.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$","gi");
	if (!myRegExpr.test(theForm.EmailAddr.value))
	{
		alert("This does not appear to be a valid email address.")
	    theForm.EmailAddr.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 jobAppVal(theForm)
{
	if (theForm.FullName.value == "")
	{
		alert("Please enter your name.");
		theForm.FullName.focus();
		return (false);
	}
	
	var myRegExpr = new RegExp("^([A-Z]+[']?|[ ]?|[-]?)+$","gi");
	if (!myRegExpr.test(theForm.FullName.value))
	{
	    alert("Please enter only letters, spaces, apostrophe or hyphen in the Name field.");
	    theForm.FullName.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.Phone.value == "")
	{
	    alert("Please enter your number in the Phone field.");
	    theForm.Phone.focus();
	    return (false);	
	}
	
	myRegExpr.compile("^([0-9]+[ ]?)+$","g");
	if (!myRegExpr.test(theForm.Phone.value))
	{
	    alert("Please enter only numbers and single spaces in the Phone field.");
	    theForm.Phone.focus();
	    return (false);
	}	
	
	if (theForm.CoverNote.value == "")
	{
		alert("Please enter a covering note.");
		theForm.CoverNote.focus();
		return (false);
	}
	
	if (theForm.CV.value == "")
	{
		alert("Please select a file to upload");
		theForm.CV.focus();
		return false;
	}
	else
	{
		var str = theForm.CV.value.toLowerCase();
		var len = str.length;
		var pos = len - 4;
		if (str.substr(pos,4) != '.pdf' && str.substr(pos,4) != '.doc' && str.substr(pos,4) != '.rtf')
		{
			  alert("Invalid file type chosen. PDF, DOC, or RTF only.");
			  theForm.CV.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;
}