// xModalDialog
// by Mike Foster (cross-browser.com)

window.onload = function()
{
  //alert('Load Event');
};
window.onunload = function() // assigning an unload listener disables bfcache (fastback) in Opera and Firefox
{
  //alert('Unload Event');
};

function xModalDialogEvento(sDialogId) // Object Prototype
{ 
  /*@cc_on @if (@_jscript_version >= 5.5) @*/ //  not supported in IE until v5.5
  this.dialog = xGetElementById(sDialogId);
  xModalDialogEvento.instances[sDialogId] = this;
  if (!xModalDialogEvento.ele) { // only one per page  	
    xModalDialogEvento.ele = document.createElement('div');
    xModalDialogEvento.ele.className = 'xModalDialogGreyElementEvento';
    document.body.appendChild(xModalDialogEvento.ele);
  }
  /*@end @*/
}

// Public Methods

xModalDialogEvento.prototype.show = function()
{
  var e = xModalDialogEvento.ele;
  if (e) {
    var ds = xDocSize();
    xMoveTo(e, 0, 0);
    xResizeTo(e, ds.w, ds.h);
    if (this.dialog) {
      this.dialog.style.display='block';
      xMoveTo(this.dialog, xScrollLeft()+(xClientWidth()-this.dialog.offsetWidth)/2, xScrollTop() + 5);
    }
  }
};

xModalDialogEvento.prototype.hide = function()
{
  var e = xModalDialogEvento.ele;
  if (e) {
    xResizeTo(e, 10, 10);
    xMoveTo(e, -10, -10);
    if (this.dialog) {
      this.dialog.style.display='none';
      xMoveTo(this.dialog, -this.dialog.offsetWidth, 0);
    }
  }
};

// Static Properties

xModalDialogEvento.ele = null;
xModalDialogEvento.instances = {};
