/** * Functions */function pop(url, width, height, scrollbars, menubar){    var w = new Popup(url, width, height, scrollbars, menubar);    w.open();};/** * Classes */function Popup(url, width, height, scrollbars, menubar){    this.directories = 0;    this.height      = height;    this.location    = 0;    this.menubar     = menubar;    this.resizable   = 1;    this.scrollbars  = scrollbars;    this.status      = 0;    this.toolbar     = 0;    this.url         = url;    this.width       = width;    this.window      = null;};Popup.prototype.close = function(){    if (this.window && ! this.window.closed)    {        if (this.window.opener && ! this.window.opener.closed) this.window.opener.focus();        this.window.close();    }};Popup.prototype.features = function(){    features  = "directories=" + (this.directories ? 1 : 0);    features += ",height="     + (this.height      ? parseInt(this.height) : 0);    features += ",location="   + (this.location    ? 1 : 0);    features += ",menubar="    + (this.menubar     ? 1 : 0);    features += ",resizable="  + (this.resizable   ? 1 : 0);    features += ",scrollbars=" + (this.scrollbars  ? 1 : 0);    features += ",toolbar="    + (this.toolbar     ? 1 : 0);    features += ",width="      + (this.width       ? parseInt(this.width) : 0);    return features;};Popup.prototype.createName = function(){    u = this.url;    i = u.lastIndexOf("/") + 1;    return u.substring(i, u.indexOf(".", i));};Popup.prototype.open = function(){    this.close();    this.window = window.open(this.url, this.createName(), this.features());    if (this.window)    {        this.window.focus();        if (this.window.opener == null) this.window.opener = self;    }};