var popup = null;
function ERS (file, WinName, width, height, scroll, resize)
{
	var doCenter = false;
	if((popup == null) || popup.closed)
	{
		attribs = "";
		if(scroll) scroll = "yes"; else scroll = "no";
		if(resize) size = "yes"; else size = "no";

		for(var item in window)
			{ if(item == "screen") { doCenter = true; break; } }

		if(doCenter)
		{
			if(screen.width <= width || screen.height <= height) size = "yes";
			WndTop  = (screen.height - height) / 2;
			WndLeft = (screen.width  - width)  / 2;
			attribs = "width=" + width + "," +
			"height=" + height + "," +
			"scrollbars=" + scroll + "," + 
			"resizable=" + size + "," + 
			"status=no," +
			"toolbar=no," +
			"directories=no," +
			"menubar=no," +
			"location=no," +
			"top=" + WndTop + "," +
			"left=" + WndLeft;
		}
		popup = open(file, WinName, attribs);
	}
	else
	{
		DestroyWnd();
		ERS(file, WinName, width, height, scroll, resize);
	}
}
