﻿function openWindow(url, width, height, menubar, toolbar, scrollbars, resizable, location, status)
{
	
	//-------------------------------------------------------
	//To compensate for the physical size of the browser menus, etc.

	var add_me = 36;
	
	if (menubar == 1)
	{
		add_me += 20;
	}
	
	if (toolbar == 1)
	{
		add_me +=  40;
	}

	if ( location == 1 )
	  {	add_me += 20;	}
	

	//-------------------------------------------------------
	//the hard work!
	
	var Xpoint, Ypoint;
	//These have to be recalculated everytime width and height change:
	Xpoint = (screen.width/2) - (width/2);
	Ypoint = (screen.height/2) - ((height+add_me)/2);
	
	
	//-- set window attributes	
	attributes = "menubar=no";
	attributes += ",toolbar=" + toolbar;
	attributes += ",scrollbars=" + scrollbars;
	attributes += ",resizable=" + resizable;
	attributes += ",location=" + location;
	attributes += ",status=" + status;
	attributes += ",history=no";
	attributes += ",locationbar=no";
	
	//-- window position
	attributes += ",height="+ height;
	attributes += ",width="+ width;
	//-- window location
	attributes += ",left="+Xpoint +",screenX="+Xpoint;
	attributes += ",top="+Ypoint +",screenY="+Ypoint;

	//alert(attributes);

    var popUp;
	if ((navigator.appName != "Netscape"))
	{
		if (popUp)			//check for open window
		{ popUp.close(); }
	}
	
	popUp = window.open(url, 'popUp', attributes);	
	popUp.focus();

	return false; //not sure why this needs to return a value, could be legacy code.

}
//-->
