﻿$(function(){
		   var Time = 5000;                            //图片延迟时间
		   var TimeHuan = 1000;                        //图片透明速度
		   var Anxz = 1;                               //当前按钮的透明度(0～1)
		   var Anwxz = 0.6;                            //未选中按钮的透明度(0～1)
		   var Zhus = 0.7;                             //注释背景透明度
		   var zsbj = 32;                              //注释框向下移动的高度，因为css里有padding:1px;
		                                               //和border:1px solid #999属性，各高出了1个像素，
													   //所以要在注释框的高度下再加上2
           var x = 0;
		   var Index = $(".hdp img").length-1;
		   var nrtop = $(".nr").css("margin-top");
		   $(".hdp img:eq("+x+")").css("opacity","1");
		   $(".hdp img:eq("+x+")").css("z-index","1");
		   $(".hdp img:gt("+x+")").css("z-index","0");
		   $(".hdp .an li:eq("+x+")").css("opacity",Anxz);
		   $(".hdp .an li:gt("+x+")").css("opacity",Anwxz);
		   $(".hdp .nr div").css("opacity",Zhus);
		   $(".hdp .nr li:eq("+x+")").css("z-index","1");
		   $(".hdp .nr li:eq("+x+")").css("opacity","1");
		   $(".hdp .nr li:gt("+x+")").css("z-index","0");
		   var Top = $(".hdp .nr").css("margin-top");
		   var tuTop = Top.replace(/[^\d]/g,"");
		   tutop = tuTop;
		   tuTop = parseInt(tuTop);
		   tuTop = tuTop+zsbj;
		   function huan(){
			   $(".hdp img:eq("+x+")").animate({opacity:"0"},TimeHuan);
			   $(".hdp img:eq("+x+")").css("z-index","0");
			   $(".hdp .an li:eq("+x+")").animate({opacity:Anwxz},TimeHuan);
			   $(".hdp .nr").animate({"margin-top":tuTop},TimeHuan/2);
			   $(".hdp .nr div,.hdp .nr li:eq("+x+")").animate({opacity:0},TimeHuan/2);
			   x++;
			   $(".hdp img:eq("+x+")").animate({opacity:"1"},TimeHuan);
			   $(".hdp img:eq("+x+")").css("z-index","1");
			   $(".hdp .an li:eq("+x+")").animate({opacity:Anxz},TimeHuan);
			   $(".hdp .an li:gt("+x+")").animate({opacity:Anwxz},TimeHuan);
			   $(".hdp .nr").animate({"margin-top":tutop},TimeHuan/2);
			   $(".hdp .nr li:eq("+x+")").animate({opacity:1},TimeHuan/2);
			   $(".hdp .nr li:gt("+x+")").css("z-index","0");
			   $(".hdp .nr li:eq("+x+")").css("z-index","1");
			   $(".hdp .nr div").animate({opacity:Zhus},TimeHuan/2);
			   if($(".hdp img:eq("+Index+")").css("opacity")==1){
				   x=0;
				   $(".hdp img:eq("+x+")").animate({opacity:"1"},TimeHuan);
				   $(".hdp img:eq("+x+")").css("z-index","1");
				   $(".hdp .an li:eq("+x+")").animate({opacity:Anxz},TimeHuan);
				   $(".hdp .nr li:eq("+x+")").animate({opacity:1},TimeHuan/2);
			       $(".hdp .nr li:gt("+x+")").css("z-index","0");
			       $(".hdp .nr li:eq("+x+")").css("z-index","1");
			       $(".hdp .nr div").animate({opacity:Zhus},TimeHuan/2);
				   }
			   }
			   $(".hdp .an li").hover(function(){
				   var y=$(this).index();
				   if(y!=x){
					   var AnIndex = $(this).index();
					   $(".hdp .an li:eq("+AnIndex+")").animate({opacity:Anxz},TimeHuan);
					   $(".hdp .an li:gt("+AnIndex+")").animate({opacity:Anwxz},TimeHuan);
					   $(".hdp .an li:eq("+x+")").animate({opacity:Anwxz},TimeHuan);
					   $(".hdp img:eq("+x+")").animate({opacity:0},TimeHuan);
					   $(".hdp img:eq("+x+")").css("z-index","0");
					   $(".hdp .nr").animate({"margin-top":tuTop},TimeHuan/2);
					   $(".hdp .nr div,.hdp .nr li:eq("+x+")").animate({opacity:0},TimeHuan/2);
					   x=AnIndex;
					   $(".hdp img:eq("+x+")").animate({opacity:1},TimeHuan);
					   $(".hdp img:eq("+x+")").css("z-index","1");
					   $(".hdp .nr").animate({"margin-top":tutop},TimeHuan/2);
					   $(".hdp .nr li:eq("+x+")").animate({opacity:1},TimeHuan/2);
					   $(".hdp .nr li:gt("+x+")").css("z-index","0");
					   $(".hdp .nr li:eq("+x+")").css("z-index","1");
					   $(".hdp .nr div").animate({opacity:Zhus},TimeHuan/2);
					   clearInterval(hua);                //点击按钮后重新
					   hua = setInterval(huan,Time);      //加载图片延迟时间
					   }
				   },function(){})
			   var hua = setInterval(huan,Time);
			   
		   })
