// JavaScript Document
function centerMainWindow(theURL,winName,features, w, h) {
  var w;
  var h;
  var str;
  var lenom;
  var str;
  lenom = features.indexOf("width=") + 6;
  fine = features.indexOf(",",lenom);
  if (fine != -1) {
     str = features.substring(lenom,fine); 
    } else {
     str = features.substring(lenom);
     }
  w = parseFloat(str)
  lenom = features.indexOf("height=") + 7;
  fine = features.indexOf(",",lenom);
  if (fine != -1) {
     str = features.substring(lenom,fine); 
    } else {
     str = features.substring(lenom);
     }
  h = parseFloat(str)

  PosX = (screen.width - w) / 2;
  PosY = (screen.height - h ) / 2;
  
  window.open(theURL,winName,features + ",left=" + PosX + ",top=" +
PosY+",screenX=" + PosX +",screenY=" + PosY);
}