/* 
	Tacita Morway
	tacita_morway@wgbh.org
	08.05.08
   ----------------------------------------------------*/

var Hilites = {

	show: function(){
		// grab the list of hilites
		var elts = $ES('li', 'hilites');
		
		// set all the hilites to hidden
		for (var i = 0; i < elts.length; i++) {
			elts[i].className = "hide";
		}		
				
		// randomly show one from the list
		var firstRand;
		firstRand = Math.floor(Math.random()*elts.length);
		elts[firstRand].className = "";

		if(document.body.id == "programIndex") {
			// show a second one from the list
			var secRand = Math.floor(Math.random()*elts.length);
			secRand = Math.floor(Math.random()*elts.length);
			
			var jump = 0;
			while (secRand == firstRand && jump < 100) {
				secRand = Math.floor(Math.random()*elts.length);
	
				// don't let it ever get stuck here
				jump++;
			}		
			elts[secRand].className = "";
		}
	}
};

window.addEvent('domready', Hilites.show);

