function StatusBar(sel,options) {
    var _I = this;       
    var _sb = null;
    // options     
    this.elementId = "_showstatus";
    this.prependMultiline = true;   
    this.showCloseButton = true; 
    this.afterTimeoutText = null;
    this.cssClass = "statusbar";
    this.highlightClass = "statusbarhighlight";
    this.errorClass = "statusbarerror";
    this.closeButtonClass = "statusbarclose";
    this.additive = false;   
    $.extend(this,options);
    if (sel)
      _sb = $(sel);
    // create statusbar object manually
    if (!_sb) {
        _sb = $("<div id='_statusbar' class='" + _I.cssClass + "'>" +
                "<div class='" + _I.closeButtonClass +  "'>" +
                (_I.showCloseButton ? " X </div></div>" : "</div>") )
                 .appendTo(document.body);                  
                 //.fadeIn("slow");
    }
    if (_I.showCloseButton)
        $("." + _I.cssClass).click(function(e) { $(_sb).hide(); });

    this.show = function(message,timeout,isError, closeOnTimeout, closeCallback) {            
        if (_I.additive) {
            var html = "<div style='margin-bottom: 2px;' >" + message + "</div>";
            if (_I.prependMultiline)
                _sb.prepend(html);
            else
                _sb.append(html);            
        } else {
            if (!_I.showCloseButton)    
                _sb.text(message);
            else {             
                var t = _sb.find("div.statusbarclose");                
                _sb.text(message).prepend(t);
            }
        }               
        _sb.fadeTo("slow", .70);        
        if (timeout) {
            if (isError)
                _sb.addClass(_I.errorClass);
            else
                _sb.addClass(_I.highlightClass);
            setTimeout(function() {
                     if (closeOnTimeout) {
            		_sb.fadeTo("slow", 0, closeCallback);
            		return;
                     }
                     _sb.removeClass(_I.errorClass);
                     _sb.removeClass(_I.highlightClass); 
                     if (_I.afterTimeoutText && !closeOnTimeout)
                       _I.show(_I.afterTimeoutText);
                 },timeout);
        }                
    };
    this.release = function()
    {
        if(_sb) {
            _sb.fadeTo("slow", 0, function () {
        	_sb.remove();
            });
        }
    };      
}