function getWindowWidth() 
{
	if (window.innerWidth) 
	{
		return window.innerWidth;
	} 
	else if (document.body && document.body.offsetWidth) 
	{
		return document.body.offsetWidth;
	}
	else 
	{
		return 0;
	}
}

function getWindowHeight() 
{
	if (window.innerHeight) 
	{
		return window.innerHeight;
	} 
	else if (document.body && document.body.offsetHeight) 
	{
		return document.body.offsetHeight;
	} 
	else 
	{
		return 0;
	}
}


function setMiddlePosition()
{
	var completeWidth = getWindowWidth();

	var wrapperWidth = document.getElementById("wrapper").offsetWidth;
	var leftMargin = (completeWidth - wrapperWidth) / 2;
	
	if (leftMargin < 0)
		leftMargin = 0;

	document.getElementById("wrapper").style.marginLeft = leftMargin + "px";
}

