<!--Check submitted email. Make sure there is a name, valid email and a message. If name, valid email or message does not exist-->
<!--send an error message to the user for them to correct what they have done wrong. If validation is good, return true so that-->
<!--the email.php script can be run.-->
function validateEmail()
{
	var name = document.getElementById('name').value;
	var email = document.getElementById('email').value;
	var message = document.getElementById('message').value;
	var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
	
	if (name == "")
	{
		window.alert("Please Enter a Name");
		return false;
	}
	
	else if(emailPattern.test(email)==false) 
	{
		window.alert("Invalid email address entered, Please try again.");
		return false;
	}
	
	else if (message == "")
	{
		window.alert("Please Enter a Message");
		return false;
	}
	
	else
	{
		return true;
	}
}