getOnLoads();

//Get layout stylesheet
var threeColStyles = document.styleSheets[0];
//Create array of stylesheet rules
var threeColRules = threeColStyles.cssRules ? threeColStyles.cssRules: threeColStyles.rules;
//Get rule for sidebar_right
for ( i=0; i<threeColRules.length; i++ ) {
	if ( threeColRules[i].selectorText.toLowerCase() == "#sidebar_right" ) {
		var sidebarRight = threeColRules[i];
	}
}
//Get background color for sidebar_right
var sidebarRightBGColor = sidebarRight.style.backgroundColor;
//Get rule for contentbackground 
for ( i=0; i<threeColRules.length; i++ ) {
	if ( threeColRules[i].selectorText.toLowerCase() == ".contentbackground" ) {
		var contentbackground = threeColRules[i];
	}
}
//Get background color for content area
var contentBGColor = contentbackground.style.backgroundColor;
//Make wrapper background color same as taller element
function fixBackground() {
	var maincontent = document.getElementById("maincontent");
	var sidebar_right = document.getElementById("sidebar_right");
	var wrapper = document.getElementById("wrapper");
	if ( maincontent.offsetHeight < sidebar_right.offsetHeight ) {
		wrapper.style.backgroundColor = contentBGColor;
	}
	else {
		wrapper.style.backgroundColor = sidebarRightBGColor;
	}
}
window.onload = function() {fixBackground();};