registerNS("EXL.UI");

// generic dialog handling code
EXL.UI.Dialog = Class.create({
  _buttonPropHash : {},
  _dlgBox : null,
  
  // instance constructor
  initialize: function(dlgName, dlgPropHash, buttonPropHash) {
  	// fixup yui props and instantiate the control
  	dlgPropHash.buttons = [buttonPropHash.submit];
  	this._buttonPropHash = buttonPropHash;
  	this._dlgBox = new YAHOO.widget.Dialog(dlgName, dlgPropHash);
  	this._dlgBox.render();
  },

  // show the dialog
  show : function(cancel_btn, me)
  {
  	// turn on the close and cancel buttons
  	if( cancel_btn)
  	{
  		this._dlgBox.cfg.setProperty("close", true);
  		this._dlgBox.cfg.setProperty("buttons", [ this._buttonPropHash.submit, this._buttonPropHash.cancel ]);
  	}
  	else
  	{
  		this._dlgBox.cfg.setProperty("close", false);
  		this._dlgBox.cfg.setProperty("buttons", [ this._buttonPropHash.submit]);
  	}

  	this._dlgBox.show();
  },
  
  // hide the dialog
  hide : function(me)
  {
  	this._dlgBox.hide();	
  }
});



