﻿var foot_timer;
function top_scroll(){
	$(".top_scroll_ul").animate({top:"-80px"},700,function(){
		$(".top_scroll_ul li:first").appendTo(".top_scroll_ul");
		$(".top_scroll_ul").css("top","0");
	})
	foot_timer=window.setTimeout("top_scroll()",4000);
}
foot_timer=window.setTimeout("top_scroll()",4000);
$(function(){    
	 var index = 0;
	 $("#btn span").mouseover(function(){
		index  =  $("#btn span").index(this);
		showImg(index);
	});	
	 //滑入 停止动画，滑出开始动画.
	 $('#imgnav').hover(function(){
			  if(MyTime){
				 clearInterval(MyTime);
			  }
	 },function(){
			  MyTime = setInterval(function(){
			    showImg(index)
				index++;
				if(index==5){index=0;}
			  } , 2000);
	 });
	 //自动开始
	 var MyTime = setInterval(function(){
		showImg(index)
		index++;
		if(index==5){index=0;}
	 } , 2000);
})
//关键函数：通过控制i ，来显示不通的幻灯片
function showImg(i){
		$("#img img")
			.eq(i).stop(true,true).fadeIn(1000)
			.parent().siblings().find("img").hide();
		$("#msg li")
			.eq(i).stop(true,true).fadeIn(1000)
			.siblings().hide();
		 $("#btn span")
			.eq(i).addClass("hov")
			.siblings().removeClass("hov");
}
$(function(){
//alert($('.nav1 ul li:eq(0) a').attr('rel'));
var Childnav = $('.nav2 ul');
var Btn = $('.nav1 a');
Btn.hover(
    function () {
        Childnav.hide();
        Btn.removeClass('on');
        $(this).addClass('on');
        var Showul = "."+$(this).attr('rel');
        $(Showul).show();
    },
    function () {
        
    }); 
})