function updateHighlights() {
	// Update the tiny image highlight, each is applied to the divs
	// as IE6 and 7 seem to object to using the #game-tiny id.
	var countTiny = 0;
	$("#game-tiny-holder div").each(function() {
		$(this).removeClass("game-tiny");
		$(this).removeClass("game-tiny-highlight");
		
		if(countTiny == currGame) {	
			$(this).addClass("game-tiny-highlight");
		}
		else {
			$(this).addClass("game-tiny");
		}
		countTiny++;
	});
}

function showNextImage() {
	// Set the visibility of the current game info holder.
	var countGame = 0;
	$("#game-info-holder .game-info").each(function() {
		if(countGame == currGame)
			$(this).css("visibility", "visible");
		else
			$(this).css("visibility", "hidden");
			
		// Set the visibility of the screenshots for this particular game.
		var countImg = 0;
		$("#game-info-holder #game-info" + countGame + " .game-screenshot").each(function() {
			// Only the active screenshot for the active game should be visible.
			if(countGame == currGame && countImg == currImg)
				$(this).css("visibility", "visible");
			else
				$(this).css("visibility", "hidden");
				
			countImg++;
		});
		countGame++;
	});
	
	updateHighlights();
	
	// Cycle the currently active game and screenshot.
	if(currImg == numImgs - 1) {
		currGame = (currGame == numGames - 1 ? 0 : currGame + 1);
		currImg = 0;
	}
	else
		currImg++
}

var numImgs, numGames;
var currImg, currGame;

function cycleFeaturedGames(ssPerGame, ssDelayMillis) {
	numImgs = ssPerGame;
	numGames = 3;
	currImg = currGame = 0;
	
	setInterval(function() { showNextImage(); }, ssDelayMillis);
}
