// Adjust Layout for Discovery News
// Created by Mike Cleek 10.28.2009

function adjustLayout()
{
	//alert('entered');
	//Get all necessary div tags
	var contentDocObj = document.getElementById('content');
	var mainTextDocObj = document.getElementById('main-text');
	var footerDocObj = document.getElementById('footer');
	var rightBarDocObj = document.getElementById('rightBar');
	
	//create variable height for specified elements
	var mainTextHeight = mainTextDocObj.offsetHeight;
	var contentHeight = contentDocObj.offsetHeight;
	var rightBarHeight = rightBarDocObj.offsetHeight;
	
	contentHeight = mainTextHeight + 20;
	//alert('content Height: ' + contentHeight);
	//alert('main-text Height: ' + mainTextHeight);
	
	var footerTop = footerDocObj.offsetTop;
	if(contentHeight < rightBarHeight - 160)
	{
		footerDocObj.style.top = rightBarHeight - contentHeight - 160 + 'px';
	}
	
	
	if(rightBarHeight <= contentHeight + 162)
	{
		rightBarHeight = mainTextHeight + 192;
	}
	else
	{
		contentHeight = rightBarHeight - 172;
	}
	
	contentDocObj.style.height = contentHeight + 'px';
	rightBarDocObj.style.height = rightBarHeight + 'px';
	//alert('rightbar Height: ' + rightBarHeight);
}
