// JavaScript
//<script language="JavaScript">

function popup(url, name, x, y, width, height) {
  var popupWindow = new PopupWindow(url, name, x, y, width, height);
  popupWindow.open();
}

function PopupWindow(url, name, x, y, width, height) {
  this.url = url;
  this.name = name;
  this.x = x;
  this.y = y;
  this.width = width;
  this.height = height;

  this.status = false;
  this.toolbar = false;
  this.location = false;
  this.scrollbars = true;
  this.resizable = true;
  this.dependent = false;

  this.open = PopupWindow_open;
}

function PopupWindow_open() {
  var properties = "";
  properties += "width=" + this.width;
  properties += ",height=" + this.height;
  properties += "outerWidth=" + this.width;
  properties += ",outerHeight=" + this.height;
  properties += ",status=" + ((this.status) ? "yes" : "no");
  //properties += ",status=no";
  properties += ",toolbar=" + ((this.toolbar) ? "yes" : "no");
  properties += ",location=" + ((this.location) ? "yes" : "no");
  properties += ",scrollbars=" + ((this.scrollbars) ? "yes" : "no");
  properties += ",resizable=" + ((this.resizable) ? "yes" : "no");
  //properties += ",resizable=no";
  properties += ",dependent=" + ((this.dependent) ? "yes" : "no");

  x = (this.x != null) ? this.x : (screen.availWidth-this.width)/2;
  y = (this.y != null) ? this.y : (screen.availHeight-this.height)/2;

  properties += ",screenX=" + x + ",screenY=" + this.y;

  this.window = window.open(this.url, this.name, properties);
  var absolute = this.url.indexOf("http://") == 0 || this.url.indexOf("https://") == 0;

  if (!absolute || (absolute && this.url.indexOf(window.location.host) >= 0)) {
    this.window.moveTo(x, y);
    this.window.resizeTo(this.width, this.height);
  }

  if (!((navigator.appName == "Microsoft Internet Explorer") && (navigator.appVersion.substring(0, 3) < "3")))
  {
    this.window.focus();
  }
  return this.window;
}
