	// Attach our handler for document ready.
    jQuery.noConflict();
    jQuery(document).ready(formatHPissues);
	var hpIssuesActiveSet;
	var hpIssuesCount;
	
    // formatPage takes care of global formatting for items and page specific formatting, if needed.
    function formatHPissues() {
		// Count how many issue sets we have
		hpIssuesCount=jQuery("#topicRotationPanel .topicSet").length;
		// Set a set to display (at random)
		hpIssuesActiveSet=Math.floor(Math.random()*hpIssuesCount)+1;
		// Hide all the elements except the desired one
		showIssueSet(hpIssuesActiveSet);
		// Set the timer
		startHPissuesTimer();
		// Set a hover to stop the timer if the mouse is over the panel
		jQuery("#topicRotationPanel").hover(stopHPissuesTimer, startHPissuesTimer);
    }
	
	function startHPissuesTimer() {
		jQuery(document).everyTime("15s","hpIssueRotatorTimer",rotateIssues);
	}

	function stopHPissuesTimer() {
		jQuery(document).stopTime("hpIssueRotatorTimer");
	}
	
	function rotateIssues() {
		if (hpIssuesActiveSet >= hpIssuesCount) { hpIssuesActiveSet=1 } else { hpIssuesActiveSet++};
		showIssueSet(hpIssuesActiveSet);
	}

	function showIssueSet(which) {
		// Hide the entire panel
		jQuery("#topicRotationPanel").hide();
		// Hide all the sets
		jQuery("#topicRotationPanel .topicSet").hide();
		// Display the correct set
		jQuery("#topicRotationPanel .topicSet:eq(" + (which-1) + ")").show();		
		// Show the entire panel again
		jQuery("#topicRotationPanel").show("fast");		
	}
