// function to initialise the closing process
function WindowClose(theWindow) {
  // PARAMETER
    /*
    // theWindow ==> [window object] (optional)
    //    reference to a specific popup.
    // RETURN
    //    -none-
    */
  // if reference is given
  if (theWindow) {
    // close a specific popup
    theWindow.close();
    // if opener is found
  	if (opener) {
      // make sure the opener swaps back to front
  		opener.focus();
    }
  // if no reference is given
  } else {
    // if opener is found
  	if (opener) {
      // make sure the opener swaps back to front
  		opener.focus();
    }
    // close this popup
  	top.close();
  }
}