//导航下拉菜单

$(function(){
	$('#nav .big_li').hover(function(){
		$(this).children('ul').slideDown();
		
	},function(){
		$(this).children('ul').slideUp();
	})
})

$(function(){
	$('#nav .big_li li').hover(function(){
		$(this).addClass('hover');
	},function(){
		$(this).removeClass('hover');
	});
})

//底部选项卡
$(function(){
	    var $div_li =$("#bottom_tab li");
	    $div_li.click(function(){
			$(this).addClass("on")            //当前<li>元素高亮
				   .siblings().removeClass("on");  //去掉其它同辈<li>元素的高亮
            var index =  $div_li.index(this);  // 获取当前点击的<li>元素 在 全部li元素中的索引。
			$("#tab_bd > div")   	//选取子节点。不选取子节点的话，会引起错误。如果里面还有div 
					.eq(index).show()   //显示 <li>元素对应的<div>元素
					.siblings().hide(); //隐藏其它几个同辈的<div>元素
		});
        $div_li.hover(function(){
            $(this).addClass("mouseover");
        },function(){
            $(this).removeClass("mouseover");
        });
});


// 首页幻灯效果

$(function(){
     var len  = $("#cycle .cycle_list li").length;
	 var index = 0;
	 var adTimer;

	 startTimer();
	$('#cycle .cycle_bd,#cycle .text').hover(function(){
                 clearInterval(adTimer);
     },function(){
              startTimer();
     });
	 $('"#cycle .cycle_list li').hover(function(){
	 		index=$('"#cycle .cycle_list li').index($(this));
	 		showImg(index);
	 });
     //自动开始
     function startTimer(){
	  adTimer = setInterval(function(){
	 		showImg(index)
	 		index++;
	 		if (index == len) {
	 			index = 0;
	 		}
	 	}, 2000);
	 }
	
})
// 来显示不同的幻灯片
function showImg(index){
		$("#cycle .cycle_bd li")
				.eq(index).show()
				.siblings().hide();
		$("#cycle .cycle_list li")
				.eq(index).addClass('on')
				.siblings().removeClass('on');
		$("#cycle .text li")
				.eq(index).show()
				.siblings().hide();		
}


//二级页侧边栏

//$(function(){
//	$('#sider_nav li').click(function(){
//		$(this).addClass('on')
//		.siblings().removeClass('on');
//	})
//})

