
function class_popup() {
    this.window     = null;
    this.name       = "default";
    this.orgname    = "defaultOpener";
    this.width      = "500";
    this.height     = "400";
    this.status         = "no";
    this.scrollbars     = "yes";
    this.resizable      = "yes";
    this.toolbar        = "no";
    this.location       = "no";
    this.directories    = "no";
    
    this.popup = function (url) {
        var mywinpos    = this.findcenter(this.width,this.height);
        var settings = "toolbar="+ this.toolbar +"," +
        "location="+ this.location +","+
        "directories="+ this.directories +","+
        "status="+ this.status +","+
        "menubar="+ this.menubar +","+
        "scrollbars="+ this.scrollbars +","+
        "resizable="+ this.resizable +","+
        "width="+ this.width +","+
        "height="+ this.height +","+
        "top="+ mywinpos[0] +","+
        "left="+ mywinpos[1] +",";

        this.window = this.launch(url, this.name, settings, this.orgname);
        this.window.focus();
    }

    this.launch = function (newURL, newName, newFeatures, orgName) {
        var remote = open(newURL, newName, newFeatures);
        if (remote.opener == null) {
            remote.opener = window;
        }
        remote.opener.name = orgName;
        return remote;
    }

    this.findcenter = function( pwinwidth, pwinheight )	{
        var winpos 		= new Array(2);
        var scrheight 	= screen.height;
        var scrwidth 	= screen.width;
        var wintop 		= (scrheight - pwinheight-100) / 2;
        var winleft 	= (scrwidth - pwinwidth) / 2;
        winpos[0] 	= wintop;
        winpos[1] 	= winleft;
        return winpos;
    }
}




function launch(newURL, newName, newFeatures, orgName) {
    var remote = open(newURL, newName, newFeatures);
    if (remote.opener == null) {
        remote.opener = window;
    }
    remote.opener.name = orgName;
    return remote;
}

function reloadclose()	{
    opener.location.reload();
    self.close();
}

function schliessen(nn){
    window.setTimeout("window.reloadclose()",(nn*1000) );
}

function popup(url, name, width, height) {
    mywinpos = findscreencenter(width,height);
    settings = "toolbar=no,location=no,directories=no,"+
    "status=no,menubar=no,scrollbars=yes,"+
    "resizable=yes,width="+width+",height="+height+",top="+mywinpos[0]+",left="+mywinpos[1];
    orgname="mymain";
    MyNewWindow=launch(url,name,settings,orgname);
    MyNewWindow.focus();
}

function findscreencenter( pwinwidth, pwinheight )	{
    winpos 		= new Array(2);
    scrheight 	= screen.height;
    scrwidth 	= screen.width;
    wintop 		= (scrheight - pwinheight-100) / 2;
    winleft 	= (scrwidth - pwinwidth) / 2;
    winpos[0] 	= wintop;
    winpos[1] 	= winleft;
    return winpos;
}

