/* opens a new window named "popUp" */
var newWindow
var editWindow
/// SUPENewWindowOpener
/// Opens a new window and reuses that window object regardless 
/// of its state.  Sets width, height, and whether the toolbar 
/// is enabled.
///
/// url > valid string url
/// x > width of the popup window
/// y > height of the popup browser window
/// tools > string: expected to be "yes" or "no"
function SUPENewWindowOpener(url,x,y,tools)
{
	x = 800;
	y = 600;
	tools = "no";
	
	if(x > window.screen.availWidth)
	{
		x = window.screen.availWidth;
	}
	if(y > window.screen.availHeight)
	{
		y = window.screen.availHeight;
	}
	if(newWindow == null)
	{
		newWindow = window.open(url,"popUp","width=" + x + ",height=" + y + ",resizable=yes,scrollbars=yes,menubar=no,toolbar=" + tools + ",location=no");
	}
	else if(newWindow.closed == true)
	{
		newWindow = window.open(url,"popUp","width=" + x + ",height=" + y + ",resizable=yes,scrollbars=yes,menubar=no,toolbar=" + tools + ",location=no");
	}
	else
	{
		newWindow.location.replace(url);
	}
	newWindow.focus();
	return(false);
}

