// genBG
// --
// generate a grey-scaled background color that fades out based on the current #
function genBG(curr_num, max_num) {
	var base = 196;
	var color = base + (((curr_num < max_num) ? curr_num : max_num) * 16);
	if (color > 255) color = 255;
	color = (color+0).toString(16);
	return '#'+color+color+color;
}

var a;
if ((a = document.getElementById("sub_navigation")) != null) {
	// sub pages
	var height = a.parentNode.clientHeight;
	a.height = height + 'px';
	document.getElementById("page_content").height = height + 'px';
	if (document.getElementById("headlines") != null) document.getElementById("headlines").height = height + 'px';
//	var b = document.getElementById("page_content"), c = document.getElementById("headlines"), p = a.parentNode;
//	a.style.height = b.style.height = a.parentNode.clientHeight + 'px';
//	if (c != null) c.style.height = a.style.height;
} else {
	// homepage
	var cell_num = 0, max_num = 5;
	while ((a = document.getElementById("homepage_news_cell_" + cell_num)) != null) a.style.backgroundColor = genBG(cell_num++, max_num);
}