  var popWindow;
 
  function setPopWindow(pWindow)
  {
    popWindow = pWindow;
  }
  function getPopWindow()
  {
    return popWindow;
  }
  function focusPopWindow()
  {
    focusWindow(getPopWindow());
  }
  function focusWindow(theWindow)
  {
    if (theWindow)
    {
      theWindow.focus();
    }
  }
  function closeWindow(theWindow)
  {
    if (theWindow)
    {
      theWindow.close();
    }
  }
  function openPopUpWindow(page, name, width, height)
  {
    return openPopUpWindow(page, name, width, height, "no", "no", "no", "no", "no", "no");
  }
  function openPopUpWindow(page, name, width, height, resizable, scrollbars, location, toolbar, menubar, status)
  {
    var properties = "width="+width+",height="+height;
    properties += ",location="+location+",resizable="+resizable;
    properties += ",toolbar="+toolbar+",menubar="+menubar;
    properties += ",scrollbars="+scrollbars+",status="+status;
    return window.open(page, name, properties);
  }
  function introducePopUpWindow(popWindowUrl, popWindowName, sizeX, sizeY)
  {
    if (getPopWindow() && !getPopWindow().closed)
    {
      focusPopWindow();
    }
    else
    { 
      setPopWindow(openPopUpWindow(popWindowUrl, popWindowName, sizeX, sizeY, "yes", "yes", "no", "no", "no", "yes"));
    }
  }