

var ContentHeight = {
	/**
	 * Height of the background tile image.
	 */
	tileHeight : 158,

	/**
	 * The bottom edge isn't cut exactly at a multiple of the
	 * tile height, so we need to adjust for that offset.
	 */
	bottomEdgeOffset : -6,

	/**
	* Round the height of the content section up to the nearest
	* multiple of the background tile height. This makes sure the
	* lower shadowed edge will always line up correctly with the
	* background pattern.
	*/
	snapToTileHeight : function() {
		var content = document.getElementById("content");
		var height = parseFloat(
			content.offsetHeight ? 
				content.offsetHeight :
				getComputedStyle(content, null).getPropertyValue("height")
		);
		//DEBUG: window.status += "Normal: " + height;
		height += ContentHeight.tileHeight - (height % ContentHeight.tileHeight) + ContentHeight.bottomEdgeOffset;
		//DEBUG: window.status += " - Adjusted: " + height;
		content.style.height = height + "px";
	}
};

if(!window.loadHandlers) {
	window.loadHandlers = [];
	window.onload = function() {
		for(var i=0; i<window.loadHandlers.length; i++) {
			window.loadHandlers[i]();
		}
	};
}
window.loadHandlers[window.loadHandlers.length] = ContentHeight.snapToTileHeight;
