function getLeftCoord(e)
{
//	var l = findLeftCoord(e);
	var l = e.offsetLeft;
//	if(IE)
//		l += e.offsetParent.clientLeft;
	
	return(l);
}

function findLeftCoord(e)
{
	var l = e.offsetLeft;
	if (e.offsetParent !== null)
	{
		l += findLeftCoord(e.offsetParent);
	}
	return(l);
}

function getTopCoord(e)
{
//	var t = findTopCoord(e);
	var t = e.offsetTop;	
//	if(IE)
//		t += e.offsetParent.clientTop;
	
	return(t);
}

function findTopCoord(e)
{
	var t = e.offsetTop;
	if (e.offsetParent !== null)
	{
		t += findTopCoord(e.offsetParent);
	}

	return(t);
}

function renderedPageHeight()
{
	var height = 0;

	if(typeof(window.innerHeight) == 'number')
	{
		height = window.innerHeight;
	}
	else
	{
		if(document.documentElement && document.documentElement.clientHeight)
		{
			height = document.documentElement.clientHeight;
		}
		else
		{
			if(document.body&&document.body.clientHeight)
			{
				height=document.body.clientHeight;
			}
		}
	}

	return(height);
}

function renderedPageWidth()
{
	var width = 0;

	if(typeof(window.innerWidth) == 'number')
	{
		width = window.innerWidth;
	}
	else
	{
		if(document.documentElement && document.documentElement.clientWidth)
		{
			width = document.documentElement.clientWidth;
		}
		else
		{
			if(document.body&&document.body.clientWidth)
			{
				width=document.body.clientWidth;
			}
		}
	}

	return(width);
}

function renderedBodyHeight()
{
	return(document.body.clientHeight);
}

function verticalScrollOffset()
{
	var y = 0;
	
	if(document.documentElement && document.documentElement.scrollTop)
	{	 // Explorer 6 Strict
		y = document.documentElement.scrollTop;
	}
	else
	{
		if(document.body)
		{// all other Explorers
			y = document.body.scrollTop;
		}
	}
	
	return(y);
}

function centerVertically(height)
{
	var top = ((renderedPageHeight() - height) / 2) + verticalScrollOffset();
	if(height > renderedPageHeight())
	{
		top = verticalScrollOffset();
	}
	return(top);
}

function centerHorizontally(width)
{
	var left = (renderedPageWidth() - width) / 2;
	if(width > renderedPageWidth())
	{
		left = 0;
	}
	return(left);
}

function setBackgroundPosition(elemid, top, left)
{
	var newbp = left + " " + top;
	ge(elemid).style.backgroundPosition = newbp;
}
