function ShowWindowSize()
{
	with (document.body)
	{
		width = offsetWidth - (2 * clientLeft);
		height = offsetHeight - (2 * clientTop);
	}
	alert('Width = ' + width + '\nHeight = ' + height);
	event.returnValue=false;
}

function OpenWindowCentered(url, WinWidth, WinHeight, WinOptions)
{
	// validate required parameter
	if (url == null) alert("OpenWindowCentered: missing url");

	// set default window width
	if (WinWidth == null) WinWidth = 650;

	// set default window height
	if (WinHeight == null) WinHeight = 540;

	if (WinOptions == null)
	{
		// set default window options
		WinOptions = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0";
	}
	
	// create unique window name based on current time
	curDate = new Date();
	WindowName = "NewWindow" + '_' + curDate.getTime();
	
	// half the screen width minus half the new window width (plus 5 pixel borders).
	var iMyWidth = (window.screen.width/2) - ((WinWidth/2) + 10);
	// half the screen height minus half the new window height (plus title and status bars).
	var iMyHeight = (window.screen.height/2) - ((WinHeight/2) + 50);
	// open the window
	var newwin = window.open(url, WindowName, "height=" + WinHeight + ",width=" + WinWidth + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ',' + WinOptions);

	// set the focus to it
	newwin.focus();

	return newwin;
}

// reopen (or create) window on the center of the screen (for dialog purposes)
function OpenDialogWindow(WinName, url, scrollbars)
{
    if (scrollbars != null && scrollbars)
	{
		var WinOptions = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=' + DialogWindowResizable
	}
	else
	{
		var WinOptions = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=' + DialogWindowResizable
	}
	return window.open(url, WinName, 'width=' + screen.width + ',height=' + screen.height + ',left='+ (screen.width+DialogWindowOffset) +',top=' + (screen.height+DialogWindowOffset) + ',' + WinOptions)
}

function OpenWindowFullScreen(url)
{
	var WinWidth = window.screen.width - 10;
	var WinHeight = window.screen.height - 28;

	// open the window
	var newwin = window.open(url, '_blank', "height=" + WinHeight + ",width=" + WinWidth + ",left=0,top=0,screenX=0,screenY=0,toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars,resizable=0");

	// set the focus to it
	return newwin.focus();
}

