// Sets up the media rotator for the featured stories on the home page

// Show only the first arrow to start
$("#featured-tabs .arrow").hide().eq(0).show();

// Initiate the cycle widget
$("#featured-content > ul").cycle({
	timeout: 9000,
	speed: 3000,
	before: function() {
		// As we cycle the image, also switch the arrows
		var eq = $(this).prevAll().length;
		setTimeout("$('#featured-tabs .arrow:visible').hide();", 1500);
		setTimeout("$('#featured-tabs .arrow:eq(" + eq + ")').show()", 1500);
	}
});

// Set tab links to go to urls from images (instead of the original hash links to the images)
$("#featured-tabs > ul > li").each(function(i) {
	var href = $("#featured-content > ul > li:eq(" + i + ") a:first").attr("href");
	$(this).find("a").attr("href", href);
});