(function(d){d.fn.carousel=function(e){e=d.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scrolls:1,beforeStart:null,afterEnd:null},e||{});return this.each(function(){var n=false,l=e.vertical?"top":"left",g=e.vertical?"height":"width";var f=d(this),p=d("ul",f),i=d("li:visible",p),t=i.size(),s=e.visible;if(e.circular){p.prepend(i.slice(t-s-1+1).clone()).append(i.slice(0,s).clone());e.start+=s}var r=d("li:visible",p),o=r.size(),u=e.start;f.css("visibility","visible");r.css({overflow:"hidden","float":e.vertical?"none":"left"});p.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});f.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var k=e.vertical?a(r):c(r);var q=k*o;var m=k*s;r.css({width:r.width(),height:r.height()});p.css(g,q+"px").css(l,-(u*k));f.css(g,m+"px");d((u-e.scrolls<0&&e.btnPrev)).addClass("prev_disabled");d((u+e.scrolls>o-s&&e.btnNext)).addClass("next_disabled");d(e.btnPrev).hover(function(){if(!d(e.btnPrev).hasClass("prev_disabled")){d(e.btnPrev).addClass("prev_hover")}},function(){d(e.btnPrev).removeClass("prev_hover")});d(e.btnNext).hover(function(){if(!d(e.btnNext).hasClass("next_disabled")){d(e.btnNext).addClass("next_hover")}},function(){d(e.btnNext).removeClass("next_hover")});if(e.btnPrev){d(e.btnPrev).click(function(){return j(u-e.scrolls)})}if(e.btnNext){d(e.btnNext).click(function(){return j(u+e.scrolls)})}if(e.btnGo){d.each(e.btnGo,function(v,w){d(w).click(function(){return j(e.circular?e.visible+v:v)})})}if(e.mouseWheel&&f.mousewheel){f.mousewheel(function(v,w){return w>0?j(u-e.scrolls):j(u+e.scrolls)})}if(e.auto){setInterval(function(){j(u+e.scrolls)},e.auto+e.speed)}function h(){return r.slice(u).slice(0,s)}function j(v){if(!n){if(e.beforeStart){e.beforeStart.call(this,h())}if(e.circular){if(v<=e.start-s-1){p.css(l,-((o-(s*2))*k)+"px");u=v==e.start-s-1?o-(s*2)-1:o-(s*2)-e.scrolls}else{if(v>=o-s+1){p.css(l,-((s)*k)+"px");u=v==o-s+1?s+1:s+e.scrolls}else{u=v}}}else{if(v<0||v>o-s){return}else{u=v}}n=true;p.animate(l=="left"?{left:-(u*k)}:{top:-(u*k)},e.speed,e.easing,function(){if(e.afterEnd){e.afterEnd.call(this,h())}n=false});if(!e.circular){d(e.btnPrev).removeClass("prev_disabled");d(e.btnNext).removeClass("next_disabled");d((u-e.scrolls<0&&e.btnPrev)).addClass("prev_disabled");d((u+e.scrolls>o-s&&e.btnNext)).addClass("next_disabled")}}return false}})};function b(e,f){return parseInt(d.css(e[0],f))||0}function c(e){return e[0].offsetWidth+b(e,"marginLeft")+b(e,"marginRight")}function a(e){return e[0].offsetHeight+b(e,"marginTop")+b(e,"marginBottom")}})(jQuery);

jQuery(document).ready(function(){
		function operateWXR()
		{
			var oText = jQuery(".list_item_on").find("img").attr("alt");
			var oSrc = jQuery(".list_item_on").find("img").attr("src");
			jQuery("#JS_text").text(oText);
			jQuery("#JS_bigImg").find("img").attr("src",oSrc);
			jQuery("#JS_bigImg").find("img").attr("alt",oText);
		};
		jQuery(".JS_Next").click(function(){
			jQuery("#JS_Slide").find(".list_item_on")
				.next("li").addClass("list_item_on")
				.siblings("li").removeClass("list_item_on");
				operateWXR();
		});
		jQuery(".JS_Prev").click(function(){
			jQuery("#JS_Slide").find(".list_item_on")
				.prev("li").addClass("list_item_on")
				.siblings("li").removeClass("list_item_on");
				operateWXR();
		});
		jQuery("#JS_Slide").find(".list_item").click(function(){
			jQuery(this).addClass("list_item_on")
			.siblings("li").removeClass("list_item_on");
			operateWXR();
		});
		jQuery("#JS_Slide").carousel({
       		btnNext: ".JS_Next",
       		btnPrev: ".JS_Prev",
			scrolls:1,
			circular: false,
			visible:5
			
  		});
})