function validateFormOnSubmit(theForm) {
var reason = "";

  reason += validateEmpty(theForm.Name);
  reason += validateEmpty(theForm.Email);
  reason += validateEmpty(theForm.Message);
      
  if (reason != "") {
    alert("Some fields need correction:\n" + reason);
    return false;
  }

  return true;
}

function validateEmpty(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.border = '1px solid red'; 
        error = "The required field " + fld.id + " has not been filled in.\n"
    } else {
        fld.style.border = '1px solid #EFD60D';
    }
    return error;  
}