/* Validate the contact form */
function contactValidate()
{
	var errorMessage = "Please complete the following information:\n\n";
	var errorFound = false;
	var contactForm = document.contactForm;

	if (contactForm.fullName.value.length == 0)
	{
		errorMessage += "Enter your full name\n";
		errorFound = true;
		contactForm.fullName.style.background = '#E6C4C4';
		contactForm.fullName.style.border = '1px solid #E6C4C4';
	}
	else
	{
		contactForm.fullName.style.background = '#E6E1E6';
		contactForm.fullName.style.border = '1px solid #E6E1E6';
	}
	
	if (!isValidEmail(contactForm.email.value))
	{
		errorMessage += "Enter a valid email address\n";
		errorFound = true;
		contactForm.email.style.background = '#E6C4C4';
		contactForm.email.style.border = '1px solid #E6C4C4';
	}
	else
	{
		contactForm.email.style.background = '#E6E1E6';
		contactForm.email.style.border = '1px solid #E6E1E6';
	}
	
	if (contactForm.comment.value.length == 0)
	{
		errorMessage += "Enter your message\n";
		errorFound = true;
		contactForm.comment.style.background = '#E6C4C4';
		contactForm.comment.style.border = '1px solid #E6C4C4';
	}
	else
	{
		contactForm.comment.style.background = '#E6E1E6';
		contactForm.comment.style.border = '1px solid #E6E1E6';
	}

	if (errorFound == true)
	{
		alert(errorMessage);
		return false;
	}
	else
	{
		return true;
	}
}

/* Verify that an email addres is valid */
function isValidEmail(emailAddress)
{
   var exclude=/[^@\-\.\+\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
   var check=/@[\w\-]+\./;
   var checkend=/\.[a-zA-Z]{2,4}$/;
   
   if (((emailAddress.search(exclude) != -1) || (emailAddress.search(check)) == -1) || (emailAddress.search(checkend) == -1))
   {
      return false;
   }
   else
   {
      return true;
   }
}