var newWin;

function OpenCW( url, winname, w, h )
{
	// NOTE: winname cannot have spaces. it is a variable name
	
	windowleft = Math.round( (screen.width - w) / 2 );
	windowtop = Math.round( (screen.height - h) / 2 );

	settings = "toolbar=no,directories=no,menubar=no,scrollbars=no,resizable=no,status=no,width=" + w + ",height=" + h + ",left=" + windowleft + ",top=" + windowtop;	
	CloseWindow();
	newWin = window.open( url, winname, settings );
	newWin.focus();	
}

function OpenCWS( url, winname, w, h )
{
	// NOTE: winname cannot have spaces. it is a variable name
	
	windowleft = Math.round( (screen.width - w) / 2 );
	windowtop = Math.round( (screen.height - h) / 2 );

	settings = "toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,status=no,width=" + w + ",height=" + h + ",left=" + windowleft + ",top=" + windowtop;	
	CloseWindow();
	newWin = window.open( url, winname, settings );
	newWin.focus();	
}

function OpenWindow( url, winname, w, h )
{
	// NOTE: winname cannot have spaces. it is a variable name
	
	windowleft = 0;
	windowtop = 0;

	settings = "toolbar=no,directories=no,menubar=no,scrollbars=no,resizable=no,status=no,width=" + w + ",height=" + h + ",left=" + windowleft + ",top=" + windowtop;	
	CloseWindow();
	newWin = window.open( url, winname, settings );
	newWin.focus();	
}

function CloseWindow()
{
	if ( newWin && !newWin.closed )
	{
		newWin.close();	
	}
}
