var top5number = 0;

function switchTop5(first){
	var visible = parseInt($('#top5_content div:visible').attr('id').replace("top5_vue_",""));
	$('#top5_action_'+visible).removeClass('num_on');
	if (visible >= top5number || first) {
		visible = 1;
	}
	else {
		visible += 1;
	}
	$('#top5_content div').hide();
	$('div#top5_vue_'+visible).show();
	$('#top5_action_'+visible).addClass('num_on');
}

$(document).ready(function () {
	
	top5number = $("a.top5_action").length;
	switchTop5(true);
	
	/* ANET TOP 5 */
   $("a.top5_action").click(function() {
		$("a.top5_action").removeClass('num_on');
		$(this).addClass('num_on');
		clearTimeout(minTop5);
		minTop5 = setInterval('switchTop5(false)', 6000);
		$('div.hide').hide();
		$('div.top5_cache_first').hide();
		$('div#top5_vue_'+this.id.replace("top5_action_","")).show();
		return false;
	});
	$('#top5_content').hover(
		function(){
			clearTimeout(minTop5);
		},function(){
			minTop5 = setInterval('switchTop5(false)', 6000);
		}
	);
	
	if ($("#top5").length){
		minTop5 = setInterval('switchTop5(false)', 6000);
	}
	
});
