var yuiLoadingPanel = function(conf){
  conf = conf == undefined ? new Array() : conf;
  conf.id = conf.id == undefined ? 'yuiLoadingPanel' : conf.id;
  conf.header = conf.header == undefined ? 'Loading, please wait...' : conf.header;
  conf.body = conf.body == undefined ? '' : conf.body;
  conf.width = conf.width == undefined ? '240px' : conf.width;
  this.conf = conf;
  this.init();
};

yuiLoadingPanel.prototype = {
  init:function(){
    this.loadingPanel = null;
  },
  
  show:function(header, body){
    if (this.loadingPanel != null) {
      this.loadingPanel.hide();
      this.loadingPanel.destroy();
    }
    
    if (YAHOO.lang.isUndefined(header)) {
      header = this.conf.header;
    }
    
    if (YAHOO.lang.isUndefined(body)) {
      body = this.conf.body;
    }
    
    this.loadingPanel = new YAHOO.widget.Panel(this.conf.id, {
      width:this.conf.width,
      fixedcenter:true,
      close:false,
      draggable:false,
      modal:true,
      visible:false
    });
    
    this.loadingPanel.setBody(header + body);
    this.loadingPanel.render(document.body);
    Dom.addClass(this.loadingPanel.id, 'yui_loading_panel');
    this.loadingPanel.show();
  },
  
  hide:function(){
    this.loadingPanel.hide();
  }
};
