﻿jQuery.noConflict(); 
jQuery(function(){
    var count=jQuery("#btn span").length;
    jQuery("#btn span:first").addClass("hov");
    jQuery("#msg li:first").css("display","block");
    jQuery("#img img:first").css("display","block");
    var index = 0;
    showImg(index);
	 jQuery("#btn span").mouseover(function(){
		index  =  jQuery("#btn span").index(this);
		showImg(index);
	});	
	 //滑入 停止动画，滑出开始动画.
	 jQuery('#imgnav').hover(function(){
			  if(MyTime){
				 clearInterval(MyTime);
			  }
	 },function(){
			  MyTime = setInterval(function(){
			    showImg(index);
				index++;
				if(index==count){index=0;}
			  } , 4000);
	 });
	 //自动开始
	 var MyTime = setInterval(function(){
		showImg(index);
		index++;
		if(index==count){index=0;}
	 } , 4000);
})

//关键函数：通过控制i ，来显示不通的幻灯片
function showImg(i){
		jQuery("#img a")
			.eq(i).stop(true,true).fadeIn(600)
			.siblings().hide();
		jQuery("#img img")
			.eq(i).stop(true,true).fadeIn(600)
			.siblings().hide();
		jQuery("#msg li")
			.eq(i).stop(true,true).fadeIn(600)
			.siblings().hide();
		 jQuery("#btn span")
			.eq(i).addClass("hov")
			.siblings().removeClass("hov");
}
$$=jQuery.noConflict();

