/* CSCIE-12, Example: 8.7  */// function that calls separate validation functions
function ValidateForm(thisform) {
    if(isNotEmpty(thisform.email)) { 
      if (isEMailAddr(thisform.email)) {
        return true;
      } else {
        return false;
      }
    } else { 
      return false; 
    }
}
// validates that the field value string has one or more characters in it
function isNotEmpty(elem) {
    var str = elem.value;
    var re = /.+/;
    if(!str.match(re)) {
        alert("Please fill in the required field.");
        return false;
    } else {
        return true;
    }
}
// validates that the entry is formatted as an email address
function isEMailAddr(elem) {
    var str = elem.value;
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!str.match(re)) {
        alert("Verify the email address format.");
        return false;
    } else {
        return true;
    }
}
