function formvalidator(theForm) {

  	   if (theForm.name.value==null || theForm.name.value == "")
	    {
	      alert("You must enter your name");
	      theForm.name.focus();
	      return (false);
  }

  	   if (theForm.comments.value==null || theForm.comments.value == "")
  	    {
  	      alert("You must fill in some comments.");
  	      theForm.comments.focus();
  	      return (false);
  }	   

  	   if (theForm.word.value==null || theForm.word.value == "")
  	    {
  	      alert("Please enter the word above.");
  	      theForm.word.focus();
  	      return (false);
  }	   
	

return true;
}

function emailCheck (emailstr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")



var matchArray=emailstr.match(emailPat)
if (matchArray==null) {
 	alert("Your email address seems incorrect.")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

if (user.match(userPat)==null) {
    alert("The username doesn't seem to be valid.")
    return false
}

var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Destination IP address is invalid!");
		return false;
	    }
    }
    return true;
}

var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("The Email domain name doesn't seem to be valid.");
    return false;
}


var atomPat=new RegExp(atom,"g");
var domArr=domain.match(atomPat);
var len=domArr.length;
if (domArr[domArr.length-1].length<2 ||
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   alert("Your email address doesn't seem to be valid.");
   return false;
}

if (len<2) {
   var errStr="This email address is missing a hostname!"
   alert(errStr)
   return false
}
return true;
}

