//Copyright (c) 2008 Joshua Napoli
//All rights reserved.
//If the window is wider than the body, then center it, horizontally.
function hCenterBody()
{
	if(document.viewport.getWidth() < $$('body')[0].getWidth())
	{
		document.body.setStyle({'left' : '0', 'marginLeft' : '0' });
	}
	else
	{
		/*We prefer to use 'left: 50%; margin-left: -width/2', since this keeps the page centered
		even while the user changes the size of the page. But IE 8 beta 1 does not use the top/left
		properties of the body element, so we special-case it. */
		if(Prototype.Browser.IE)
		{
			document.body.setStyle(
				{'left' : '0'
				,'marginLeft' : (document.viewport.getWidth()-document.body.getWidth())/2+'px'});
		}
		else
		{
			document.body.setStyle(
				{'left' : '50%'
				,'marginLeft' : -document.body.getWidth()/2+'px' });
		}
	}
}
Event.observe(window, 'load', function() {
	hCenterBody();
	Event.observe(window, 'resize', hCenterBody);
});