var annBar = null;
var featureIndex = 0;
var isFocused = 0;
var siteFeaturesDelay = 5000;

$(document).ready(function() {

	// Code for animated ticker
	annBar = $("#animated_ticker .animated_ticker_items li").hide().size();
	$("#animated_ticker .animated_ticker_items li:eq(" + featureIndex + ")").show();
	$("#animated_ticker").hover(function() {
		isFocused = 1;
	}, function() {
		isFocused = 0;
	});
	setInterval(updateSiteFeatures, siteFeaturesDelay);
	
	// Code for other interesting items
	$(".other_items_of_interest li").hover(
		function () {
			$(this).addClass("oioiOn");
		},
		function () {
			$(this).removeClass("oioiOn");
		}
	);
	
});

function updateSiteFeatures() {
	if (isFocused) return;
	$("#animated_ticker .animated_ticker_items li:eq(" + featureIndex + ")").fadeOut("slow", function() {
		$(this).hide();
		featureIndex = (featureIndex + 1) % annBar;
		$("#animated_ticker .animated_ticker_items li:eq(" + featureIndex + ")").fadeIn("slow");
	});
}