function popupWindow(url, name, width, height, status, toolbar, menubar, scrollbars, resizable)
{
	var oWindowSize;
	var options="";
	var popup;

	oWindowSize = windowSize();

	options += ", width = "  + width;
	options += ", height = " + height;

	if (status == null)
		status = 0;
	if (toolbar == null)
		toolbar = 0;
	if (menubar == null)
		menubar = 0;
	if (scrollbars == null)
		scrollbars = 0;
	if (resizable == null)
		resizable = 0;

	if (oWindowSize.width < 25)
		oWindowSize.width = 0;
	options += ", left = 0";// + ((oWindowSize.width / 2) - (width / 2));
	
	if (oWindowSize.height < 50)
		oWindowSize.height = 0;
	options += ", top = 0";// + ((oWindowSize.height / 2) - (height / 2));

	options += ", status = "     + status;
	options += ", toolbar = "    + toolbar;
	options += ", menubar = "    + menubar;
	options += ", scrollbars = " + scrollbars;
	options += ", resizable = "  + resizable;
	
	popup = window.open(url, name, options);
	if (window.focus)
		popup.focus();
}

function windowSize()
{
	var width = 0, height = 0;
	var oWindowSize;

	if(typeof(window.innerWidth) == 'number')
	{
		// Non-IE
		width  = window.innerWidth;
		height = window.innerHeight;
	}
	else if(document.documentElement && 
			 (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		// IE 6+ in 'standards compliant mode'
		width  = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	}
	else if(document.body &&
			 (document.body.clientWidth || document.body.clientHeight))
	{
		// IE 4 compatible
		width  = document.body.clientWidth;
		height = document.body.clientHeight;
	}

	oWindowSize = new OWindowSize(width, height);
	return oWindowSize;
}

function OWindowSize(width, height)
{
	var width, height;
	this.width  = width;
	this.height = height;	
}
