function CreatePopupWindow(windowname, url, width, height)
{
  // tests for the existence of the window.focus method. window.focus is how we bring the popup to the front every time, even though it was already open. Some older browsers do not have window.focus -- those browsers degrade gracefully by failing out of the function and going to the popup's URL in the current window. Note that there are no parentheses after window.focus because we are testing for the existence of the function, not running it.
  if (! window.focus)
    return true;
  // Line 6 declares the href variable, which holds the URL to which the popup should navigate. Lines 7 to 10 figure out what that URL is. In 7 we test if mylink is a string. If it is a string, in line 8 we assign to href the value of the string. If mylink is not a string then we assume it is an <A ...> or <AREA ...> object and in line 10 assign to href the value of the objects href property (which was set in the HREF attribute of the <A ...> or <AREA ...> tag).
  var href, left, top;
  // center popup window
  left = (screen.width - width) / 2
  top = (screen.height - height) / 2
  if (typeof(url) == 'string')
     href=url;
  else
     href=url.href;
  window.open(url, windowname, 'width='+width+',left='+left+',top='+top+',height='+height+',resizable=no,scrollbars=yes');
  //return false to cancel the click on the link. If we don't return false the link will navigate the current window to the URL of the popup
  //return false;
}

function printPage() {
  if (window.print) window.print();
    self.close();
}

