var MyNewWindow = "";

function popup(url, name, width, height, tool, loc, direct, stat, menu, scroll, resize,flscreen){

   if (width == "max" || height == "max"){
      width = 640;
      height = 480;
      x=0;
      
      w=screen.availWidth;
      h=screen.availHeight;
      if (w > 800){
         x = screen.availWidth * 0.049;
         w = w - (2 * x);
         h = h - (2 * x);
      }
   }

   settings="toolbar="+tool+",location="+loc+",directories="+direct+",status="+stat+",menubar="+menu+",scrollbars="+scroll+",resizable="+resize+",width="+width+",height="+height+",fullscreen="+flscreen;

   if (MyNewWindow.location && !MyNewWindow.closed)
   {
      MyNewWindow.close();
   }
   MyNewWindow = window.open(url,name,settings); 
   if(flscreen != "yes"){
       //MyNewWindow.focus();
       //MyNewWindow.moveTo(x,x);
       //MyNewWindow.window.resizeTo(w,h);
   }
}

function popup_notflscr(){
   if (MyNewWindow.location && !MyNewWindow.closed)
   {
      MyNewWindow.close();
   }
   MyNewWindow = window.open(settings); 
}