/*
Function:
	openWin();
Purpose:
	This function provides the ability to open a new
	window without having to know the various specific 
	options available in the defailt javascript.
Parameters:
	HEIGHT - The height of the window
		(This parameter requires a value.)
	MENUBAR - Show the menu bar
	NAME - Name of the new window
		(This parameter requires a value.)
	PAGE - the destination address for the new window,
		relative and absolute URLs are acceptable.
		(This parameter requires a value.)
	RESIZE - Allow the window to be resized
	SCROLL - Show the sroll bars (if necessary)
	STATUS - Show the status bar
	TOOLBAR - Show the tool bar (icons)
	WIDTH - the width of the window
		(This parameter requires a value.)
Usage:
	Paramaters should be entered without any kind of
	quotation (as they are variables and not strings).
	Paramaters that require a value should be followed by
	a comma and the value (see sample).
	All other parameters are singular entities. If left 
	out of the function call they will be left off. If
	provided to the function they will be turned on.
	The function should be called with a minimum of the
	height, width, and destination (though this is not
	necessary as default values are provided for all 
	variables).
Sample:
	openWin(PAGE, 'http://www.project2061.org', HEIGHT, 350, WIDTH, 200, STATUS)
*/

// Initialize openWin variables.
var HEIGHT = 'HEIGHT';
var MENUBAR = 'MENUBAR';
var NAME = 'NAME';
var RESIZE = 'RESIZE';
var SCROLL = 'SCROLL';
var STATUS = 'STATUS';
var TOOLBAR = 'TOOLBAR';
var WIDTH = 'WIDTH';
var PAGE = 'URL';
function openWin() {
   var strParam;
   var location = 'http://www.project2061.org';
   var winName = 'popup';
   var w = 450;
   var h = 300;
   var bolMenu = 0;
   var bolResize = 'no';
   var bolScroll = 'no';
   var bolStatus = 0;
   var bolTool = 0;
   for (i = 0; i <= openWin.arguments.length; i++) {
      switch (openWin.arguments[i]) {
         case 'HEIGHT':
            h = openWin.arguments[i+1];
            i++;
            break;
         case 'MENUBAR':
            bolMenu = 1;
            break;
         case 'NAME':
            winName = openWin.arguments[i+1];
            i++;
            break;
         case 'RESIZE':
            bolResize = 1;
            break;
         case 'SCROLL':
            bolScroll = 1;
            break;
         case 'STATUS':
            bolStatus = 1;
            break;
         case 'TOOLBAR':
            bolTool = 1;
            break;
         case 'WIDTH':
            w = openWin.arguments[i+1];
            i++;
            break;
         case 'URL':
            location = openWin.arguments[i+1];
            i++;
            break;
      }
   }
   eval(winName+"=window.open(location, winName, 'toolbar='+bolTool+',location=0,directories=0,status='+bolStatus+',menubar='+bolMenu+',scrollbars='+bolScroll+',resizable='+bolResize+',width='+w+',height='+h)");
   eval(winName+".focus()");
}
