
var LOGO_RESIZE_MAX_SPACING = 170;
var LOGO_RESIZE_PAGE_WIDTH = 900;

function getWindowWidth()
{
	if ( window.innerWidth )
	{
		return window.innerWidth;
	}
	else if ( document.documentElement && document.documentElement.clientWidth )
	{
		return document.documentElement.clientWidth;
	}
	else
	{
		return document.body.clientWidth;
	}
}

function getLogo()
{
	return document.getElementById('logo');
}

function getLogoSpacing()
{
	var windowWidth = getWindowWidth();
	var spacing = LOGO_RESIZE_PAGE_WIDTH - windowWidth;
	if ( spacing < 0 )
	{
		spacing = 0;
	}
	else if ( spacing > LOGO_RESIZE_MAX_SPACING )
	{
		spacing = LOGO_RESIZE_MAX_SPACING;
	}
	return spacing;
}

function resizeWindowEvent()
{
	var logo = getLogo();
	var spacing = getLogoSpacing();
	logo.style.marginRight = spacing + 'px';
}

if ( window.attachEvent )
{
	window.attachEvent('onload', resizeWindowEvent);
	window.attachEvent('onresize', resizeWindowEvent);
}
else if ( window.addEventListener )
{
	window.addEventListener('load', resizeWindowEvent, true);
	window.addEventListener('resize', resizeWindowEvent, true);
}