// javascript script/popup.js

var screenW = screen.availWidth;
var screenH = screen.availHeight;
var screenT = screen.availTop;

function doPopup(n)
{
  f = this.page(n);

  if (this.win && !this.win.closed)
  { 
    if (this.resize)
      this.win.resizeTo(this.w,this.h);

    this.win.location.replace(f);
  }
  else
    this.win = open(f,this.name,this.args+',width='+this.w+',height='+this.h);
}

function popupObj(name,args,func,resize,w,h)
{
  this.win    = null;
  this.name   = name;
  this.args   = args;
  this.popup  = doPopup;
  this.page   = func;
  this.resize = resize;
  this.w      = w;
  this.h      = h;

  return this;
}

function closePopup(o)
{
  if (o.win && !o.win.closed)
    o.win.close();
}