// wincenter.js
// Centers windows on screens

  function openPercWindow(url, name, w, h, perc) {
    // initialize winX and winY to default values
    // for cases where Screen object isn't supported
    var winX = 0;
    var winY = 0;
    winX = (screen.availWidth - w) * perc * .01;
    winY = (screen.availHeight - h) * perc * .01;
    popupWin = window.open(url, name,'width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY +',directories=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,menubar=no');
  }

  function openCenteredWin( win_url, win_name, win_width, win_height ) {
    var winX, winY;
    if( screen.availWidth )
      winX = ((screen.availWidth / 2) - (win_width / 2));
    else
      winX = 50;
    if( screen.availHeight )
      // substract about 60 pix off the y-axis for positioning "goldener Schnitt" alike :)
      winY = ((screen.availHeight / 2)  - (win_height / 2) - 60 );
    else
      winY = 50;

    popupWin = window.open( win_url, win_name, 'width=' + win_width + ',height=' + win_height + ',left=' + winX + ',top=' + winY +',directories=no,status=no,toolbar=no,scrollbars=no,resizable=yes,menubar=no' );
    popupWin.focus();
  }

  function openCenteredScrollWin( win_url, win_name, win_width, win_height ) {
    var winX, winY;
    if( screen.availWidth )
      winX = ((screen.availWidth / 2) - (win_width / 2));
    else
      winX = 50;
    if( screen.availHeight )
      // substract about 60 pix off the y-axis for positioning "goldener Schnitt" alike :)
      winY = ((screen.availHeight / 2)  - (win_height / 2) - 60 );
    else
      winY = 50;

    popupWin = window.open( win_url, win_name, 'width=' + win_width + ',height=' + win_height + ',left=' + winX + ',top=' + winY +',directories=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,menubar=no' );
    popupWin.focus();
  }


// the end
