// -------------------------------------------------- Open centered window
// Aufrufender Link: <a href="javascript:OpenBrWindow(800,600,'dateiname.htm','fenstername')">Link</a>

function OpenBrWindow(x,y,theURL,winName) {
    var x;
    var y;
    
    ScreenWidth = screen.width;
    ScreenHeight = screen.height;
    
    xpos = (ScreenWidth/2)-(x/2);
    ypos = (ScreenHeight/2.3)-(y/2);
    
    features = "width=" + x + ",height=" + y + ",location=no,menubar=no,personalbar=no,resizable=no,screenX=" + xpos + ",screenY=" + ypos + ",left=" + xpos + ",top=" + ypos + ",locationbar=no,scrollbars=no,directories=no,statusbar=no,toolbar=no";
    
    window.open(theURL,winName,features);
}


// -------------------------------------------------- Open centered window 2
// Aufrufender Link: <a href="javascript:OpenBrWindow2(800,600,'dateiname.htm','fenstername')">Link</a>
// Mit Menubar (Drucken) und Srollbars

function OpenBrWindow2(x,y,theURL,winName) {
var x;
var y;

ScreenWidth = screen.width;
ScreenHeight = screen.height;

xpos = (ScreenWidth/2)-(x/2);
ypos = (ScreenHeight/2.3)-(y/2);

features = "width=" + x + ",height=" + y + ",location=no,menubar=yes,personalbar=no,resizable=no,screenX=" + xpos + ",screenY=" + ypos + ",left=" + xpos + ",top=" + ypos + ",locationbar=no,scrollbars=yes,directories=no,statusbar=no,toolbar=no";

window.open(theURL,winName,features);
}


// opens Microsite in Browser without URL Field, Buttons ans Menus
//new function to allow authors to determine window size and name
function openMicrositeWindow2(x,y,theURL,winName) {

  xmin = Math.min(x,screen.availWidth-10);
  ymin = Math.min(y,screen.availHeight-36);

  xpos = (screen.availWidth-(xmin+10))/2;
  ypos = (screen.availHeight-(ymin+36))/2;

  properties = "width=" + xmin + ",height=" + ymin + ",location=no,menubar=no,personalbar=no,resizable=no,screenX=" + xpos + ",screenY=" + ypos + ",left=" + xpos + ",top=" + ypos + ",locationbar=no,scrollbars=yes,directories=no,statusbar=no,toolbar=no";
    
  window.open(theURL,winName,properties).focus();
}


// ----------------------------------------------> ShowHide Layers

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}



/**
 * Shows a document in a popup window with the specified size.
 *
 * @param the document's URL
 * @param the window name
 */
function showInSizedPopup(documentURL, windowName, width, height) {
    var w = window.open(documentURL, windowName,
        "width=" + width + ",height=" + height);
    w.moveTo((screen.width - width) / 2, (screen.height - height) / 2);
    w.focus();
}

function showInSizedScrollPopup(documentURL, windowName, width, height) {
    var w = window.open(documentURL, windowName,
        "width=" + width + ",height=" + height +",scrollbars=yes,resizable=yes,location=yes,menubar=yes,status=yes,toolbar=yes,");
    w.moveTo((screen.width - width) / 2, (screen.height - height) / 2);
    w.focus();
}

/**
 * Shows a document in a popup window with default size.
 *
 * @param the document's URL
 * @param the window name
 */
function showInPopup(documentURL, windowName) {
    showInSizedPopup(documentURL, windowName,
        DEFAULT_POPUP_WIDTH, DEFAULT_POPUP_HEIGHT);
}
