/*
 * ZWPPopup
 *
 * Creates a popup window
 */

function ZWPPopup(id, class_name)
{
  // create popup element

  var e = xCreateElement('div');

  this.ele = e;
  e.id = id;
  e.style.position = 'absolute';
  e.style.visibility ='hidden';
  e.className = class_name;
  
  document.body.appendChild(e);

  // init
  this.open = false;
  this.margin = 10;
}

ZWPPopup.prototype.Hide = function() // hide popup
{
  if (this.open) {
    var e = this.ele;
    e.style.visibility='hidden';
    this.open = false;
  }
};

ZWPPopup.prototype.Show = function() // show
{
  if (!this.open) {
    var e = this.ele;
    e.style.visibility = 'visible';
    this.open = true;
  }
};

ZWPPopup.prototype.Destroy = function()
{
  document.body.removeChild(this.ele);
};

ZWPPopup.prototype.MoveTo = function(x,y) // show
{
  xLeft(this.ele,x);
  xTop(this.ele,y);
};