$(function(){
var flg=0;
var flgr=0;
  function move(){
   $(".full img").eq(flg).fadeIn("slow");
   $(".full img").not($(".full img").eq(flg)).fadeOut("slow");
   $(".pictext").eq(flg).fadeIn("slow");
   $(".pictext").not($(".pictext").eq(flg)).fadeOut("slow");
   $(".picbg").fadeTo(300, 0.5);
   $(".small li").eq(flg).addClass("picbj");
   $(".small li").not($(".small li").eq(flg)).removeClass("picbj");
   $(".small li:eq("+flg+") img").css({"border":"#fff solid 1px"});
   $(".small li img").not($(".small li:eq("+flg+") img")).css({"border":"#c4c5c6 solid 1px"});
   flg=flg+1;
   t=setTimeout(move,3000);
   if(flg==4){flg=0;}
  }
  move();
  $(".showpic").hover(function(){
	flgr=0;
	clearTimeout(t);
  },function(){
	if(flgr==0){
	setTimeout(move,3000);
	}else{
	flg=flg+1;
	setTimeout(move,3000);
	}
	});
  $("ul.small li").each(function(i){
  
  $(this).click(function(){
  flgr=1;
	 flg=i;
	 $(".full img").eq(flg).fadeIn("slow");
   $(".full img").not($(".full img").eq(flg)).fadeOut("slow");
   $(".pictext").eq(flg).fadeIn("slow");
   $(".pictext").not($(".pictext").eq(flg)).fadeOut("slow");
   $(".picbg").fadeTo(300, 0.5);
   $(".small li").eq(flg).addClass("picbj");
   $(".small li").not($(".small li").eq(flg)).removeClass("picbj");
   $(".small li:eq("+flg+") img").css({"border":"#fff solid 1px"});
   $(".small li img").not($(".small li:eq("+flg+") img")).css({"border":"#c4c5c6 solid 1px"});
	});
   });
});

