//////////////////////////////////////////////////////////////////////////////
//	jaxerrorelement
//////////////////////////////////////////////////////////////////////////////
Jax.Widgets.ErrorElement = function() {
    var m_buffer = [];

    // Declare class and set instance.
    Jax.oop.declare(Jax.Widgets.ErrorElement, Jax.Widgets.Element);
    this.setInstance();
    
    // Set properties.
    this.element = null;
	
    //////////////////////////////////////////////////////////////////////////
    // initialize
    //////////////////////////////////////////////////////////////////////////
    this.initialize = function(args) {
        this.name = args[0];
        this.parent = args[1];
		this.element = document.getElementById(this.name);
        this.hide();
    }
    
    //////////////////////////////////////////////////////////////////////////
    // add(message)
    //////////////////////////////////////////////////////////////////////////
    this.add = function(message) {
        m_buffer.push(message);
    }
    
    //////////////////////////////////////////////////////////////////////////
    // clear()
    //////////////////////////////////////////////////////////////////////////
    this.clear = function() {
        m_buffer = [];
        this.hide();
    }
    
    //////////////////////////////////////////////////////////////////////////
    // write()
    //////////////////////////////////////////////////////////////////////////
    this.write = function() {
        var html = "";
        m_buffer.forEach(function(item) {
            if (html !== "") {
                html += "<br>";
            }
            
            html += item;
        });
        
        this.setText(html);
    }
    
    //////////////////////////////////////////////////////////////////////////
    // Initialize instance.
    //////////////////////////////////////////////////////////////////////////
    if (arguments.length) {
        this.initialize(arguments);
    }
};