/*******************************************************
/js/popup.js
*******************************************************/

var popWindow //-- Global reference to the pop-up window

/******************************
Close any instance of popWindow
*******************************/
function closeWindow()
{
  if (popWindow && ! popWindow.closed )
    popWindow.close();
}


/*********************************************
Create a pop-up window
Parameters:
  address: file to display in the pop-up window
  high:    height of the pop-up window
  wide:    width of the pop-up window
*********************************************/
function popup( address, high, wide )
{
  var leftMargin =( screen.width - wide )/2; //-- center horizontally
  var topMargin  =( screen.height- high )/2; //-- center vertically

  var winSetting  = '"toolbar=no, resizable=yes, ';
      winSetting += 'scrollbars=yes, status=no, ';
      winSetting += 'directories=no, menubar=no, ';
      winSetting += 'left='+leftMargin+', top='+topMargin+', ';
      winSetting += 'width='+wide+', height='+high+'"';

  closeWindow(); //--- close any current instance of popWindow

  popWindow = window.open(address, 'popWindow', winSetting );

  popWindow.focus();
}
