function highlightSelectedCategory()
{
	var nIndex = 0;
		
	while( $('categorylink'+nIndex) != null)
	{
		var item = $('categorylink'+nIndex)
		
		if (item.hasClassName($F('selCategoryId')))
		{
			item.addClassName('selected');
		}
		else
		{
			item.removeClassName('selected');
		}
		
		nIndex++;
	}
}


function rotateHeadlines()
{
	var nLastHeadlineIndex = parseInt(jQuery(".headlines .selected").attr('id').substring(2));
	var nHeadlineIndex     = (nLastHeadlineIndex+1) % 4;
	
	jQuery(".headlines #im"+nLastHeadlineIndex).hide();
	jQuery(".headlines #im"+nHeadlineIndex).show();

	jQuery(".headlines #hl"+nLastHeadlineIndex).removeClass("selected");
	jQuery(".headlines #hl"+nHeadlineIndex).addClass("selected");
	
}

function topStoriesMostRead()
{
	setVisibility("topStoriesMostCommented", false);
	setVisibility("topStoriesMostRead",      true);
	
	lineUpQuizAndMostCommented();	
}

function topStoriesMostCommented()
{
	setVisibility("topStoriesMostCommented", true);
	setVisibility("topStoriesMostRead",      false);

	lineUpQuizAndMostCommented();
}

function lineUpQuizAndMostCommented()
{
	lineUpByID("#quizcontent", "#topstoriescontent");
}

function lineUpByID(sId1, sId2)
{
	jQuery(sId1).css({'height': (jQuery(sId2).innerHeight()-10)+"px"});
	
	/*
	var nQuizHeight    = jQuery("#quizcontent").height();
	var nStoriesHeight = jQuery("#topstoriescontent").height()-5;
	
	alert("quiz height:"+nQuizHeight+"\ntop height:"+nStoriesHeight+" ");
	
	if (nStoriesHeight != nQuizHeight)
	{
		jQuery("#quizcontent").css({'height': nStoriesHeight+"px"});
	}
	*/
}

