/**
 * In The Name of Allah, The Most Gracious, The Most Merciful
 */


function centeralizeLayer(Layer)
{
	return CenteralizeDivLayer(Layer);
}

function CenteralizeLayer(DivID)
{
	var DivLayer = xGetElementById(DivID);

	if (xVisibility(DivLayer) != 'visible')
	{return;}

	if (document.body.scrollLeft)
	{var scrollLeft = document.body.scrollLeft;}
	else
	{var scrollLeft = 0;}

	if (document.body.scrollTop)
	{var scrollTop = document.body.scrollTop}
	else
	{var scrollTop = 0;}

	if (document.documentElement.clientWidth)
	{var clientWidth = document.documentElement.clientWidth;}
	else
	{var clientWidth = 800;}

	if (document.documentElement.clientHeight)
	{var clientHeight = document.documentElement.clientHeight;}
	else
	{var clientHeight = 600;}

	if (DivLayer.style.Width)
	{var DivWidth = parseInt(DivLayer.style.Width);}
	else
	{var DivWidth = 300;}

	if (DivLayer.style.Height)
	{var DivHeight = parseInt(DivLayer.style.Height);}
	else
	{var DivHeight = 50;}

	var xpos1 = scrollLeft + Math.floor(clientWidth / 2) - Math.floor(DivWidth / 2) - 0;
	var ypos1 = scrollTop + Math.floor(clientHeight / 2) - Math.floor(DivHeight / 2) - 0;

	DivLayer.style.top = ypos1 + 'px';
//	DivLayer.style.left = '40px'; /*xpos1*/;
	DivLayer.style.left = xpos1 + 'px';

}
