// PopupWindow.js

function PopupWindow(szURL, nWidth, nHeight, bCenter)
{
	// cast the parameters passed in to the proper data types:
	szURL   = String(szURL);
	nWidth  = Number(nWidth);
	nHeight = Number(nHeight);
	bCenter = Number(bCenter);

	// validate that a URL was specified:
	if((szURL == "") || (szURL == "undefined") || (szURL == "null"))
		return;

	// determine the "features" string for the popup window:
	var szFeatures = "status=no,toolbar=no,menubar=no,location=no";
	if(!isNaN(nWidth))
		szFeatures += ",width=" + String(nWidth);
	if(!isNaN(nHeight))
		szFeatures += ",height=" + String(nHeight);
	if(!isNaN(nWidth) && !isNaN(nHeight) && !isNaN(bCenter) && bCenter)
	{
		var nAvailWidth  = Number(document.all ? window.screen.width  : screen.width);
		var nAvailHeight = Number(document.all ? window.screen.height : screen.height);
		if(!isNaN(nAvailWidth) && !isNaN(nAvailHeight))
		{
			var nLeft = Math.max(0, (nAvailWidth  - nWidth )/2);
			var nTop  = Math.max(0, (nAvailHeight - nHeight)/2);
			szFeatures += ",left=" + String(nLeft) + ",top=" + String(nTop);
		}
	}

	// open the specified popup window:
	window.open(szURL, null, szFeatures);
}	// end PopupWindow(szURL, nWidth, nHeight, bCenter)


