
$(function(){
	 var index = 1;
	 var k = $('#carouselWrap ul li').length - 5;
	 if($('#carouselWrap ul li').length > 5) {$(".next").addClass("right_hover");}
	 
	 $(".next").click(function(){
	  if(index <=k) {
	  var _index = index*105;
	  $('#carouselWrap ul').animate({left:-_index},{queue: false, duration: 500},++index)
	  if(index > k){$(".next").removeClass("right_hover");}
	  if(index <= k+1){$(".pre").addClass("left_hover");}
	 }
	 })
	 
	 $(".pre").click(function(){
	 if (index != 1) {
	 var _index = -105*(index-2);
	 $('#carouselWrap ul').animate({left:_index},{queue: false, duration: 500},--index);
	 if(index == 1){$(".pre").removeClass("left_hover");}
	 if(index <= k){$(".next").addClass("right_hover");}
	 }
	 })
	 $('#carouselWrap ul li').click(function(){
	   _this = $(this);
	   $(this).siblings().find("span").addClass("cover");
	   $(this).find("span").removeClass("cover");
	  $('#showPic img').animate({opacity:0.3},{duration: 500,complete:function(){
	   $("#showPic img").attr({src:_this.find("img").attr("src")});
	   $("#showPic .title").html(_this.find("img").attr("alt"));
	    $('#showPic img').animate({opacity: 1},{duration: 1000});
	  }});   
	 })
})
