var tabgroup=new Array(Array("newsNav","noticNav","noticNav2"),Array("p1","p2","p3","p4","p5"));
var b=new Array(2);
var ontab;
function tabchange(ob){
	//alert(ob.attr('id'));
	//alert(ob.id);
	if(ob.id==ontab)return;
	for(key1 in tabgroup){
		for(key2 in tabgroup[key1]){
			if(tabgroup[key1][key2]==ob.id){
				num=key1;
			}
		}
	}
	if(b[num])clearTimeout(b[num]);
	for(key in tabgroup[num]){
		if(tabgroup[num][key]!=ob.id){
			$("#"+tabgroup[num][key]).removeClass('select');
			$("#"+tabgroup[num][key]+"Ul").fadeOut(500);
		}
	}
	ontab=ob.id;
	$(ob).addClass('select');
	b[num]=window.setTimeout(function a(){$("#"+ob.id+"Ul").fadeIn(500); b[num]=null;},510);
}
var i=1;
function tabrun(num){
	//alert(tabgroup[num][i++]);
	d=setInterval(function a(){tabchange(document.getElementById(tabgroup[num][i++]));if(i==5)i=0},4000);
}
var e;
$(document).ready(function(){
	for(key1 in tabgroup){
		for(key2 in tabgroup[key1]){
			$("#"+tabgroup[key1][key2]).hover(function(){var ob;ob=this;e=window.setTimeout(function(){javascript:tabchange(ob);},400);},function(){if(e)clearTimeout(e);});
			$("#"+tabgroup[key1][key2]).click(function (){javascript:tabchange(this);})
		}
	}
	tabrun(1);
	$('#productCenter ul li').hover(function(){clearInterval(d);},function(){tabrun(1);});
	$('#commendProduct ul li').hover(function(){$('#commendProduct ul li').css('color','#F66');},function(){$('#commendProduct ul li').css('color','white');});
});