/* ------------------------------------------------------------
 * PROJECT        : Matrix Games
 * FILENAME       : matrix.js
 * ------------------------------------------------------------
 * DATE CREATED   : 14 Sep 2007
 * LAST UPDATED   : 24 Jun 2008
 * ------------------------------------------------------------
 * AUTHOR(S)      : Kevin Scholl (http://www.ksscholl.com/)
 * ------------------------------------------------------------
 * NOTE(S)        : 
 * ------------------------------------------------------------ */
 
/* ------------------------------------------------------------
 * POPUP WINDOW: GLOBAL VARIABLE(S)
 * ------------------------------------------------------------ */

var POPWIN  = null;

/* ------------------------------------------------------------
 * POPUP WINDOW: CLOSE EXISTING POPUP WINDOW
 * ------------------------------------------------------------ */

function closePopWin(theWin) {
  if ((theWin != null) && (theWin.closed != true))
  	theWin.close();
	}

/* ------------------------------------------------------------
 * POPUP WINDOW: DISPLAY POPUP WINDOW
 * ------------------------------------------------------------ */

function popWindow(loc,w,h,m,t) {

  closePopWin(POPWIN);	// closes an existing popup window if user opens 
                				// new window before closing existing window
	
	if (!(w)) var winW = screen.width - 100; 
	else      var winW = w + 20;
	if (!(h)) var winH = screen.height - 100; 
	else      var winH = h + 20;
	
	var menu           = (m ? m : "no");
	var tool           = (t ? t : "no");
	
	var params  = "width=" + winW + ",height=" + winH + ",status=yes,toolbar=" + tool + ",directories=no,scrollbars=yes,resizable=yes,menubar=" + menu + ",location=no,top=50,left=50,screeny=50,screenx=50";

	POPWIN = window.open(loc,"FHSC",params);
	POPWIN.focus;
	}
