
var t = n = count = pp = 0;
$(function(){
	count = $("#tab_list a").size();
	//$("#tab_list a:not(:first-child)").hide();
	//$("#tab_info").html($("#tab_list a:first-child").find("img").attr('alt'));
	$("#tab_text li:first-child").css({"background":"#F4720A",'color':'#fff'});
	//$("#tab_info").click(function(){window.open($("#tab_list a:first-child").attr('href'), "_blank")});
	$("#tab_text li").click(function() {
		var i = $(this).text() - 1;
		n = i;
		if (i >= count) return;
		//$("#tab_info").html($("#tab_list a").eq(i).find("img").attr('alt'));
		//$("#tab_info").unbind().click(function(){window.open($("#tab_list a").eq(i).attr('href'), "_blank")})
		//$("#tab_list a").filter(":visible").fadeOut(100).parent().children().eq(i).fadeIn(100);

		var $active = $('#tab_list a.active');
		var $next = $('#tab_list a').eq(n) ;//$active.next();
		$active.addClass('last-active');
	    	$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 1000, function() {
			    $active.removeClass('active last-active');
		});
		//$("#tab_list a").fadeOut(1000).parent().children().eq(i).fadeIn(1000);
		$(this).css({"background":"#F4720A",'color':'#fff'}).siblings().css({"background":"#000",'color':'#fff'});
		//$(this).siblings();
	});
	t = setInterval("showAuto()", 4000);
	$("#tab").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 4000);});
})

function showAuto()
{
	n = n >= (count - 1) ? 0 : n + 1;
	$("#tab_text li").eq(n).trigger('click');
}

