 

  // Global reference to popup window
   var g_pwin = null;
   var g_top = null;
   var g_left = null;

   /**
    * Opens window based on global vars defined above
    * @param the url of the window you want to open
    */  
   function openwin(popupURL, wi, hi) {
     // Open the file popupURL in a new popup window
     if ( g_pwin && (! g_pwin.closed) ) // if help window already open, re-focus
       {
         g_pwin.location = popupURL;
         g_pwin.focus();
         return;
       }
       
       g_top = (screen.height - hi)/2;
       g_left = (screen.width - wi)/2;
  
       g_pwin = window.open(popupURL, "helpwin", "width=" + wi +",height=" + hi + ",top=" + g_top + ",left=" + g_left + ",scrollbars,resizable=1"); // open the window

       if (!g_pwin) // if can't open, inform user of failure
         {
             alert("ERROR: Could not open secondary browser window.\nYou may have too many applications running simultaneously on your computer.");
         }
    }
	

   /**
    * If popup window exists, kill it
    */ 
    function killPopup() {
      if ( g_pwin && (! g_pwin.closed) )
         g_pwin.close();
    }


