var PageForm = Class.create();
PageForm.prototype = {
  initialize: function() {
    this.errors = [];
  },
  addError: function(error) {
    this.errors.push(error);
  },
  hasErrors: function() {
    return this.errors.size() > 0;
  },
  showErrors: function(containerId) {
    if (!$(containerId)) {
      alert("No target container ID specified for showing of errors");
      return false;
    }
    this.errors.each(function(error) {
      $(containerId).appendChild(Builder.node('p', {className: 'error'}, error));
      //this.addMessage(containerId, error, 'error');
    });
  },
  addMessage: function(containerId, message, className) {
    $(containerId).appendChild(Builder.node('p', {className: className}, message));
  },
  clearErrors: function() {
    this.errors.clear();
  }
}
