DM.Validation.Msg = iClass.create({
  initialize: function( args ) {  
    if ( args == undefined ) args = {};
    
    this.float    = args.float == true;
    this.bordered = args.bordered == true;
  
    this.errors   = [];
    this.element  = null;
    this.markuped = false;
  }, // initialize
  
  markup: function() {
    var errorDiv = cr( 'DIV' );
  
    if ( this.errors.length > 0 ) {
      this.markuped = true;
    
      if ( this.bordered ) {
        var errorTable       = crTable();
        var errorTBody       = cr( 'TBODY' );
        var errorHeaderRow   = cr( 'TR' );
        var errorContentRow  = cr( 'TR' );
        var errorFooterRow   = cr( 'TR' );
        var errorHeaderCell  = cr( 'TD' );
        var errorContentCell = cr( 'TD' );
        var errorFooterCell  = cr( 'TD' );
        var errorHeaderDiv   = cr( 'DIV' );
        var errorFooterDiv   = cr( 'DIV' );
      } // if  
      
      var errorContentUL   = cr( 'UL' );
    
      if ( this.bordered ) {
        errorDiv.appendChild( errorTable );
        errorTable.appendChild( errorTBody );
        errorTBody.appendChild( errorHeaderRow );
        errorTBody.appendChild( errorContentRow );
        errorTBody.appendChild( errorFooterRow );
        errorHeaderRow.appendChild( errorHeaderCell );
        errorContentRow.appendChild( errorContentCell );
        errorFooterRow.appendChild( errorFooterCell );
        errorHeaderCell.appendChild( errorHeaderDiv );
        errorContentCell.appendChild( errorContentUL );
        errorFooterCell.appendChild( errorFooterDiv );
      } else {
        errorDiv.appendChild( errorContentUL );
      } // if
    
      errorDiv.className         = 'dm_form_validation';
    
      if ( this.bordered ) {
        errorTable.className       = 'message';
        errorHeaderCell.className  = 'header';
        errorContentCell.className = 'content';
        errorFooterCell.className  = 'footer';
      } // if
    
      this.element  = errorDiv;
      this.errorsUL = errorContentUL;
    
      this.addErrors();
    } // if
    
    return errorDiv;
  }, // show
  
  hide: function() {
    if ( this.element ) rmObj( this.element );
    this.markuped = false;
  }, // hide
  
  addErrors: function() {
    removeChildren( this.errorsUL );
  
    for ( var i=0; i < this.errors.length; i++ ) {
      var error = this.errors[i];
      var errorItem = cr( 'LI' );
     
      errorItem.innerHTML = error;
      this.errorsUL.appendChild( errorItem );
    } // for
  }, // addErrors
  
  update: function() {
    if ( this.errors.length > 0 ) {
      this.addErrors();
    } else {
      this.hide();
    } // if
  }, // update
  
  clear: function() {
    this.errors = [];
  } // clear
}); // DM.Validation.Msg
