 	//关键函数：通过控制i ，来显示不通的幻灯片
function showImg(i){
	$("#img a")
		.eq(i).stop(true,true).fadeIn(800)
		.siblings("a").fadeOut(800);
	 $("#btn span")
		.eq(i).addClass("hov")
		.siblings().removeClass("hov");
}
$(document).ready(function(){
	$("#img a").eq(0).show();
	$("#btn span").eq(0).addClass('hov'); 
	$("#showtext").empty().append($("#img a").eq(0).attr('title'));
	
	 var index = 0;
	 $("#btn span").mouseover(function(){
		index  =  $("#btn span").index(this);
		showImg(index);
	});	
	 var lenght=$("#img a").length;
	 var time=3000;
	 
	 //滑入 停止动画，滑出开始动画.
	 $('#frame').hover(
	 	function(){
			  if(MyTime){
				 clearInterval(MyTime);
			  }
		 },function(){
			  	MyTime = setInterval(function(){
			    showImg(index)
				index++;
				if(index==lenght){index=0;}
			  } , time);
	 });
	 //自动开始
	 var MyTime = setInterval(function(){
		showImg(index)
		index++;
		if(index==lenght){index=0;}
	 } , time);
})


	/*下拉 select*/
	$(function(){
		$(".select-click").click(function(){
			var showUl=$(this).parents("dl").find("li");
			var showdl=$(this).parents("dl");
			var inputValue=$(this).siblings("input")
			$(this).parents("dt").siblings("dd").toggle();
			$(this).parents("dt").siblings("dd");
			showUl.click(function(){
				var selectText=$(this).text()
				inputValue.val(selectText)
				$(this).parents("dd").hide()
			});
			showUl.hover(function(){
				$(this).css("background-color","#F1F1F1")
			},function(){
				$(this).css("background-color","#FFF")
			});
			showdl.hover(function(){
			    return false;
			},function(){
				setTimeout(function(){
					showdl.find("dd").slideUp(200)
				},400)
			});
		})
	})
