function OpenWindow(location, width, height, scrollable, resizable)
{
	var features = "width=" + width + ",height=" + height;
	
	if (scrollable)
	{
		features += ",scrollbars=yes";
	}
	else
	{
		features += ",scrollbars=no";
	}
	
	if (resizable)
	{
		features += ",resizable=yes";
	}
	else
	{
		features += ",resizable=no";
	}
	
	var popup = window.open(location, "", features);
	Center(popup, width, height);
}

function Center(wnd, nWidth, nHeight)
{
	var posX = Math.round((screen.availWidth-nWidth)/2);
	var posY=  Math.round((screen.availHeight-nHeight)/2);
	wnd.moveTo(posX,posY);
}

function AddLoadEvent(func) 
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function') 
	{
		window.onload = func;
	} 
	else 
	{
		window.onload = function() 
		{
			oldonload();
			func();
		}
	}
}


