function isBlank(s) {  // return TRUE if string is blank
    for(var i=0; i < s.length; i++) {
      var c= s.charAt(i);
      if (( c != ' ') && (c != '\n') && (c != '\t')) return false;
    }
    return true; 
}

function checkData(f) {
    var msg;
    var errors = "";;
    for (i=0; i < required.length; i++) {
      var e= eval("f." + required[i]);
      if((e.value==null) || (e.value=="") || isBlank(e.value)) {
        errors += "\n        " + required[i];
      }
    }
    if ( errors == "") return true;

    msg = "---------------------------------------------------------------\n";
    msg += "This form was not submitted because of the \nfollowing error(s).\n";
    msg += "Please correct these error(s) and re-submit.\n"; 
    msg += "---------------------------------------------------------------\n\n";
    msg += "The following required fields are empty:" + errors;
    alert(msg);
    return false;
}