
var popUp;

///////////////////////////////////////////////////////////////////////////////////

//-- standard pop-up window
function openthewindow(url, width, height)
{
	return openthewindow_ex(url, width, height, 0, 0, 0, 0, 0);	//,"no", "no", "no", "no");
}

///////////////////////////////////////////////////////////////////////////////////

//-- extended pop-up window
function openthewindow_ex(url, width, height, menubar, toolbar, scrollbars, resizable, location)
{
	
	//-------------------------------------------------------
	//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=" + menubar;
	attributes += ",toolbar=" + toolbar;
	attributes += ",scrollbars=" + scrollbars;
	attributes += ",resizable=" + resizable;
	attributes += ",location=" + location;
	
	//-- window position
	if (width)
	 { attributes += ",width="+ width; }
	
	if (height)
	 { attributes += ",height="+ height; }
	
	//-- window location
	attributes += ",left="+Xpoint +",screenX="+Xpoint;
	attributes += ",top="+Ypoint +",screenY="+Ypoint;

	//alert(attributes);

	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.

}


