function checkForm()
{
 if(document.contactform.Name.value == "")
  {
   alert("Please enter your name.");
   document.contactform.Name.focus();
   return false;
  }  

// check email part 1: field required
 if(document.contactform.Email.value == "")
  {
   alert("Please enter your Email address.");
   document.contactform.Email.focus();
   return false;
  }
// check email part 2: basic validation of formatting rules
 if ((document.contactform.Email.value.indexOf(' ')  > -1) || // are there any spaces in the address
	  (document.contactform.Email.value.indexOf('@') == -1) ||  // is the @ missing
     (document.contactform.Email.value.indexOf('@') == 0) ||  // address can't start with an @
     (document.contactform.Email.value.indexOf('@') != document.contactform.Email.value.lastIndexOf('@')) || // is there more than one @
     (document.contactform.Email.value.lastIndexOf('.') == -1) || // is the dot . missing
     (document.contactform.Email.value.lastIndexOf('.') <= document.contactform.Email.value.indexOf('@') + 1) ||  // is there nothing between the @ and the dot
     (document.contactform.Email.value.lastIndexOf('.') >= document.contactform.Email.value.length -2)) // the dot can't be one of the last two characters
   {
   alert("Sorry, this is not a valid Email address.");
   document.contactform.Email.focus();
   return false;
   } 
 var invalid = "!#$%^&*()/:;,+";
 var is_invalid = "yes";
 var characters = "";
 for (var i=0; i < invalid.length; i++)
    {
        characters = invalid.charAt(i);
        if (document.contactform.Email.value.indexOf(characters) > -1)
        {
            is_invalid = "no";
        }
    }
    if (is_invalid == "no")
    {
    alert("Sorry, there are invalid characters in your Email address.");
   document.contactform.Email.focus();
   return false;
    }
 return true;
}


