if (Form                  == undefined) var Form              = { };
if (Form.Validator        == undefined) Form.Validator        = { };
if (Form.Validator.Report == undefined) Form.Validator.Report = { };

Form.Validator.Report.InnerHTML = function(fv) {
  this.fv       = fv;
  this.messages = { };
};

Form.Validator.Report.InnerHTML.prototype = {

  fv        : null,
  messages  : null,
  prefix    : "",
  suffix    : "_errors",
  separator : ", ",
  onSuccess : "OK",

  start: function(constraints) {
    var i;
    for (i = 0; i < constraints.length; i++) {
      var c = constraints[i];
      var id = this.prefix + c.field + this.suffix;
      this.messages[id] = { 
        list      : [ ],
        onSuccess : c.onSuccess || this.onSuccess
      };
    }
  },

  run: function(ok, c) {
    if (!ok) {
      var id = this.prefix + c.field + this.suffix;
      list= this.messages[id].list;
      this.messages[id].list.push(c.onFailure);
      return false;
    }
    return true;
  },

  finish: function() {
    return 0;
    var key;
    for (id in this.messages) {
      var list = this.messages[id].list;
      var element = document.getElementById(id);
      if (list.length > 0) {
        element.innerHTML = list.join(this.separator);
      } else {
        element.innerHTML = 
          this.messages[id].onSuccess ||
          this.onSuccess;
      }
    }
    this.messages = { };
  }

};
