var gOK

function validateNames() {
gOK = true
var firstname = document.contactinfo.FName.value;
var lastname = document.contactinfo.LName.value;
//check to see if an entry has been made in first name field
    if (firstname == "" || firstname == null) {
    alert ("Please enter your first name")
    document.contactinfo.FName.focus()
    gOK = false
        } else {
//check to see if an entry has been made in last name field
           if (lastname == "" || lastname == null) {
           alert ("Please enter your last name")
           document.contactinfo.LName.focus()
           gOK = false
        }
    } 
   return gOK;    
}



function validateEmail() {
//checks email to make sure it is a valid entry
gOK = true
emailaddress = new String(document.contactinfo.from.value);
     if (emailaddress.indexOf("@",0)== -1 || emailaddress.indexOf(".",0)== -1 || emailaddress == "") {
     alert("You must enter a valid email address");
     document.contactinfo.from.value == "";
     document.contactinfo.from.focus();
     gOK = false
    }           
     return gOK;                     
 }




function validateTextArea() {                 
//checks length of textarea which is not to exceed 90 characters - THIS WORKS
gOK = true
textString = new String(document.contactinfo.Comments12.value)
var textLength = textString.length
     if (textLength > 90) {    
     alert("Your message is " + textLength + " characters.  You must limit your message entry to 90 characters")
     document.contactinfo.Comments12.focus();
     gOK = false
    }
     return gOK;
}



function validate() {

if (!validateNames())
  return false;
if (!validateEmail())
  return false;
if (!validateTextArea())
  return false;
//Submit form if all fields valid
document.contactinfo.submit();
}
