   var legendWindow;
   var infoWindow;
   var historyWindow;
   
   function open_legend(url,w_id) {
     if (!legendWindow || legendWindow.closed){
       if (document.all)
          var xMax = screen.width, yMax=screen.height;
       else
         if (document.layers)
            var xMax=window.outerWidth, yMax=window.outerHeight;
         else
            var xMax = 640, yMax=480;

       var newX = 620, newY=440;
       var xOffset = (xMax-newX)/2 , yOffset = (yMax-newY)/2;

       legendWindow=window.open(url,w_id,'width='+newX+',height='+newY+
                        ',screenX='+xOffset+',screenY='+yOffset+
			',top='+yOffset+',left='+xOffset+
			",scrollbars=1,resizable=1,toolbar=0,menubar=0");
     } else legendWindow.focus();
  }

  function new_window(url, windowID) {
      infoWindow = window.open(url,windowID);
      infoWindow.focus();
    }

  function new_window_sized(url, windowID,xSize,ySize) {
      sizedWindow = window.open(url,windowID,'width='+xSize+',height='+ySize+
                           ',scrollbars=1,resizable=1,toolbar=1,menubar=1');
      sizedWindow.focus();
    }

  function small_window(url, wID) {
     if (!historyWindow || historyWindow.closed){
       if (document.all)
          var xMax = screen.width, yMax=screen.height;
       else
         if (document.layers)
            var xMax=window.outerWidth, yMax=window.outerHeight;
         else
            var xMax = 440, yMax=640;

       var newX = 400, newY=600;
       var xOffset = (xMax-newX)/2 , yOffset = (yMax-newY)/2;

       historyWindow=window.open(url,wID,'width='+newX+',height='+newY+
                        ',screenX='+xOffset+',screenY='+yOffset+
			',top='+yOffset+',left='+xOffset+
			",scrollbars=1,resizable=1,toolbar=0,menubar=0");
     } else historyWindow.focus();
    }
 