!function(e){e.fn.shortslider=function(t){function i(){if("fade"==o.style){var e=b-1;c.find("ul li").eq(e).hasClass("currentItem")||(c.find("ul li").removeClass("currentItem").fadeOut(500),c.find("ul li").eq(e).addClass("currentItem").fadeIn(500,function(){1==o.flick&&c.find("ul li").not(":animated").css({left:0})}))}else c.find("ul li").removeClass("currentItem"),"carousel"==o.style?(c.find("ul li").eq(b).addClass("currentItem"),I=b*u,(1!=b||b!=m)&&c.find("ul").stop().animate({left:-I},o.movementSpeed)):(c.find("ul li").eq(b-1).addClass("currentItem"),I=b*u-u,c.find("ul").stop().animate({left:-I},o.movementSpeed));c.find(".indicator span").removeClass("current"),c.find(".indicator span").eq(b-1).addClass("current")}function n(){if(1==o.auto)if(1==o.rand){var e=b;s(e),i()}else m>b?(b++,i()):(b=1,"carousel"==o.style?(I=u*m+u,c.find("ul").stop().animate({left:-I},o.movementSpeed,function(){c.find("ul").stop().css({left:-u})}),c.find(".indicator span").removeClass("current"),c.find(".indicator span").eq(0).addClass("current")):i())}function s(e){b=Math.round(Math.random()*m),b==e&&s(e),0==b&&s(e)}function a(){var t=e('').appendTo(c.find(o.itemDisplay));setTimeout(function(){t.remove()},400)}function l(){function e(e){var t=e.touches[0];"touchstart"==e.type&&(clearInterval(C),I=parseInt(s.css("left").replace("px","")),a=t.pageX,l=t.pageY),"touchmove"==e.type&&(r=t.pageX,d=t.pageY,p=r-a,f=d-l,moveRate=p/f,moveRate>Math.tan(30*Math.PI/180)&&e.preventDefault(),"fade"==o.style?s.find("li.currentItem").css({left:(p+I)/5}):s.css({left:p+I})),"touchend"==e.type&&(clearInterval(C),-50>p?b+=1:p>50?b-=1:("fade"==o.style&&s.find("li.currentItem").stop().animate({left:0},o.movementSpeed),s.stop().animate({left:I},o.movementSpeed)),b>m?"fade"==o.style?(c.find(".indicator span").removeClass("current"),c.find(".indicator span").eq(1).addClass("current"),b=1,i()):"carousel"==o.style?(c.find("ul").stop().animate({left:-u*m-u},o.movementSpeed,function(){c.find("ul").stop().css({left:-u})}),c.find(".indicator span").removeClass("current"),c.find(".indicator span").eq(0).addClass("current"),b=1):(s.stop().animate({left:I},o.movementSpeed),b=m):1>b?("fade"==o.style?(c.find(".indicator span").removeClass("current"),c.find(".indicator span").eq(m-1).addClass("current"),b=m,i()):"carousel"==o.style?(s.stop().animate({left:0},o.movementSpeed,function(){s.css({left:-m*u})}),c.find(".indicator span").removeClass("current"),c.find(".indicator span").eq(m-1).addClass("current")):s.stop().animate({left:I},o.movementSpeed),"carousel"==o.style?b=m:"fade"==!o.style&&(b=1)):i(),p=0,C=setInterval(n,o.speed))}var t=c.find("ul")[0],s=c.find("ul");t.addEventListener("touchstart",e,!1),t.addEventListener("touchmove",e,!1),t.addEventListener("touchend",e,!1);var a,l,r,d,p,f}var r,d={itemDisplay:".itemDisplay",style:"nomal",movementSpeed:500,group:1,flick:!0,rand:!1,hoverStop:!0,speed:3e3,auto:!0,indicator:!0,indicatorStyle:!0,PrevNext:!0,PrevNextStyle:!0};if(thisID=null!=this.attr("id")?"#"+this.attr("id"):"",r=null!=this.attr("class")?"."+this.attr("class").replace(/ /g,"."):"",thisSelector=thisID+r,0===this.length)return this;if(this.length>1)return this.each(function(){e(this).shortslider(t)}),this;var o=e.extend(d,t),c=this;c.children("ul").addClass("shortSliderUL").wrap('
');var p=c.find(" li:first-child img:first").clone().prependTo(c.find(o.itemDisplay)).css({zIndex:-10,visibility:"hidden",width:"100%",display:"block"}).addClass("sizer");if(0==p.length){var f=' ';c.find(o.itemDisplay).prepend(e(f))}var u=c.find(o.itemDisplay).width();if("carousel"==o.style)var h=u;else var h=0;e(window).bind("resize load",function(){u=c.find(o.itemDisplay).width(),i(),c.find("ul li").css({width:u}),1==o.PrevNext;var e=c.find(o.itemDisplay).height();0==p.length&&c.find("ul.shortSliderUL li").css({height:e})}),c.find("ul li").css({width:u}),c.find("ul").css({width:99999,left:-h,position:"absolute",top:0}),c.find("ul li").css({"float":"left"});var m=c.find("ul li").length;if(e(o.itemDisplay).css({overflow:"hidden",position:"relative"}),"carousel"==o.style){var v=c.find("ul li:first-child").clone(),y=c.find("ul li:last-child").clone();c.find("ul").append(v),c.find("ul").prepend(y),c.find("ul li:first-child").addClass("lastItem"),c.find("ul li:last-child").addClass("firstItem")}if(1==o.indicator&&m>1){for(var x=e('').appendTo(c),g=0;m>g;g++)x.append(""+parseInt(g+1)+"");1==o.indicatorStyle&&e("body").append('')));var I,b=1;"fade"==o.style?(c.find("ul li").css({position:"absolute",display:"none"}),c.find(".indicator span:first-child").addClass("current"),c.find("ul li:first-child").addClass("currentItem").fadeIn(500)):(c.find(".indicator span:first-child").addClass("current"),"carousel"==o.style?c.find("ul li:nth-child(2)").addClass("currentItem"):c.find("ul li:first-child").addClass("currentItem"));var C=setInterval(n,o.speed);return 1==o.hoverStop&&c.find("ul").hover(function(){clearInterval(C)},function(){C=setInterval(n,o.speed)}),c.find(".indicator span").click(function(){clearInterval(C);var e=c.find(".indicator span").index(this);b=e+1,i(),C=setInterval(n,o.speed)}),c.find("a.prev").click(function(){return a(),clearInterval(C),1==b?(b=m,"carousel"==o.style?(I=0,c.find("ul").stop().animate({left:I},o.movementSpeed,function(){c.find("ul").stop().css({left:-b*u})}),c.find(".indicator span").removeClass("current"),c.find(".indicator span").eq(m-1).addClass("current")):i()):(b-=1,i()),C=setInterval(n,o.speed),!1}),c.find("a.next").click(function(){return a(),clearInterval(C),b==m?(b=1,"carousel"==o.style?(I=u*m+u,c.find("ul").stop().animate({left:-I},o.movementSpeed,function(){c.find("ul").stop().css({left:-u})}),c.find(".indicator span").removeClass("current"),c.find(".indicator span").eq(0).addClass("current")):i()):(b+=1,i()),C=setInterval(n,o.speed),!1}),1==o.flick&&l(),this}}(jQuery);