function OnPagePopup(PopupWindowID, Width, Height)
{
	var ScreenWidth;
	var ScreenHeight;
	var ScreenTop;
	var BrowserHeight;
	var BrowserWidth;
	
	if (document.body.scrollHeight > 0)
	{
		ScreenWidth = document.body.scrollWidth;
		ScreenHeight = document.body.scrollHeight;
	}
	else
	{
		ScreenWidth = document.documentElement.scrollWidth;
		ScreenHeight = document.documentElement.scrollHeight;
	}

	if (window.innerHeight > 0)
	{
		BrowserWidth = window.innerWidth;
		BrowserHeight = window.innerHeight;
	}
	else
	{
		BrowserWidth = document.documentElement.offsetWidth;
		BrowserHeight = document.documentElement.offsetHeight;
	}

	ScreenTop = posTop();
	
	if (Width == -1)
	{
		document.getElementById(PopupWindowID).style.left = '0px'; 
		document.getElementById(PopupWindowID).style.width = '100%';
	}
	else
	{
		document.getElementById(PopupWindowID).style.left = ((BrowserWidth/2) - (Width/2)) + 'px'; 
		document.getElementById(PopupWindowID).style.width = Width + 'px';
	}

	if (Height == -1)
	{
		document.getElementById(PopupWindowID).style.top = '0px'; 
		document.getElementById(PopupWindowID).style.height = '100%';
	}
	else
	{
		document.getElementById(PopupWindowID).style.top = ScreenTop + (((BrowserHeight/2) - (Height/2)) - 0) + 'px'; 
		document.getElementById(PopupWindowID).style.height = Height + 'px';		
	}
	
	document.getElementById(PopupWindowID).style.display = 'block'; 
	
	document.getElementById("black-out").style.width = '100%';
	document.getElementById("black-out").style.height = ScreenHeight + 'px';
	
	DisplayDiv('black-out');
	DisplayDiv(PopupWindowID);
}


function CloseOnPagePopup(PopupWindowID)
{
	HideDiv(PopupWindowID);
	HideDiv('black-out');
}

// fix for IE position:fixed bug
function posTop()
{
	return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
} 
