function submitForm() {
if ( (VerifyName()) && (VerifyEmail()) ) {
  return true
   }   
    return false
}

function VerifyName() {
  var str = document.commentform.realname.value;
   if (str == "") {
      alert("\nPlease enter your name.")
      document.commentform.realname.focus();
      return false;
    }
  for (var i = 0; i < str.length; i++) {
     var ch = str.substring(i, i + 1);
     if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != " " && ch != "_") {
         alert("\nThe NAME field only accepts letters, spaces and _. \n\nPlease re-enter your name.");
        document.commentform.realname.focus();
        return false;
     }
  }
     return true;
}

function VerifyEmail() {
if (document.commentform.email.value == "") {
  alert("Please Enter Your Email Address.");
  document.commentform.email.focus();
  return false;
 }

/*
----- are there spaces which are invalid? -----
*/


var sp = document.commentform.email.value.indexOf(" ")
if (sp != -1) {
    alert("Invalid email address, can't use spaces!")
    document.commentform.email.focus();
    return false
   }

/*
----- is there a @? -----
*/

var str = document.commentform.email.value.indexOf("@")
var c = str+1
if (str == -1) {
    alert("Invalid email address, no @!")
    document.commentform.email.focus();
    return false
   }
/*
----- is there a period? -----
*/

var pr = document.commentform.email.value.indexOf(".",str)
if (pr == -1) {
    alert("Invalid email address, no period, '.', or period before the @")
    document.commentform.email.focus();
    return false
   }
/*
----- are there at least 2 characters between the @ and .? -----
*/

if (pr - str - 1 < 2) {
  alert("There must be at least 2 characters between the '@' and '.'")
   return false
}
/*
----- are there are least 2 characters after the .? -----
*/

var x = document.commentform.email.value.length - pr -1
if ( x < 2 ) {
  alert("There must be at least 2 characters after the period!")
   return false
}
return true  
}
