/*首页头版头条广告效果*/
$(function(){
     var len  = $(".num > li").length;
	 var index = 0;
	 var adTimer;
	 $(".num li").click(function(){
		index  =   $(".num li").index(this);
		showImg(index);
	 }).eq(0).mouseover();	
	 //滑入 停止动画，滑出开始动画.
	 $('.ad_mainbox .borderbox').hover(function(){
			 clearInterval(adTimer);
		 },function(){
			 adTimer = setInterval(function(){
			    showImg(index)
				index++;
				if(index==len){index=0;}
			  } , 5000);
	 }).trigger("mouseleave");
})
// 通过控制top ，来显示不同的幻灯片
function showImg(index){
        var adHeight = $(".ad_mainbox .borderbox").height();
		$(".slider").stop(true,false).animate({top : -adHeight*index},1000);
		$(".num li").removeClass("on")
			.eq(index).addClass("on");
}
/*首页幕后头条广告效果*/
$(function(){
     var len2  = $(".num2 > li").length;
	 var index2 = 0;
	 var adTimer2;
	 $(".num2 li").click(function(){
		index2  =   $(".num2 li").index(this);
		showImg2(index2);
	 }).eq(0).mouseover();	
	 //滑入 停止动画，滑出开始动画.
	 $('.muhou .borderbox').hover(function(){
			 clearInterval(adTimer2);
		 },function(){
			 adTimer2 = setInterval(function(){
			    showImg2(index2)
				index2++;
				if(index2==len2){index2=0;}
			  } , 7000);
	 }).trigger("mouseleave");
})
// 通过控制top ，来显示不同的幻灯片
function showImg2(index2){
        var adHeight2 = $(".muhou .borderbox").height();
		$(".slider2").stop(true,false).animate({top : -adHeight2*index2},1);
		$(".num2 li").removeClass("on")
			.eq(index2).addClass("on");
}