var openedWin = null;

function launch() {
 var args = launch.arguments;
 var url = args[0];
 var width = args[1];
 var height = args[2];
 var params = '';
 if (!url || !width || !height) {
  alert("Error");
 } else {
  var NewX = Math.max(0, Math.floor((screen.availWidth - (width + 8)) / 2));
  var NewY = Math.max(0, Math.floor((screen.availHeight - (height + 27)) / 2));
  params += "width=" + width;
  params += ",height=" + height;
  params += ",screenx=" + NewX;
  params += ",screeny=" + NewY;
  params += ",left=" + NewX;
  params += ",top=" + NewY;
  params += ",scrollbars=" + (args[3] ? "yes" : "no");
  params += ",resizable=" + (args[3] ? "yes" : "no");
  params += ",location=" + (args[4] ? "yes" : "no");

  closeChild();

  openedWin = window.open(url, "", params + ",toolbar=no,menubar=no,status=no,directories=no" );
  }
 }

function closeChild() {
 if (openedWin !== null) {
   if (!openedWin.closed) {
   openedWin.close();
   }
  }
 }

onfiltered= closeChild;