// JavaScript Document
(function(a){a.fn.scroll=function(e){var b={displayNum:4,scrollNum:2,duration:300,continuous:false,autoScroll:false,timer:6000};a.extend(b,e);return this.each(function(){var i=a(this),r=b.displayNum,A=b.duration,t=b.timer,k=i.find("div"),l=k.find("ul"),q=l.find("li"),f=q.length,n=f>r,u=b.vertical?q.outerHeight(true):q.outerWidth(true),F=i.find("span:eq(0)"),h=i.find("span:eq(1)"),j=false,B=true,E=b.vertical?"top":"left",p=b.vertical?"height":"width",s=b.scrollNum||1,ad=0,D=0,g=f-r,C=false,ac=b.autoScroll,v=b.preview;lastScroll=g%s;k.css(p,r*u+"px");l.css(p,q.length*u+"px");w();if(n){h.bind("mousedown",function(){clearInterval(ac);x(true)}).bind("mouseup",function(){j=false;w()});F.bind("mousedown",function(){clearInterval(ac);y(true)}).bind("mouseup",function(){j=false;w()})}q.hover(function(){clearInterval(ac)},function(){w()});function y(G){if(D<=0||C){return}B=false;j=G||false;D-=D==lastScroll?lastScroll:s;m(D)}function x(G){if(D>=g||C){return}j=G||false;B=true;D+=g-D==lastScroll?lastScroll:s;m(D)}function w(){if(!ac||!n){return}ac=setInterval(function(){x()},t)}function m(G){D=G;C=true;var H={};H[E]="-"+D*u+"px";l.animate(H,A,function(){C=false;if(b.continuous){if(B&&D>=g){l.css(E,"-"+ad*u+"px");D=ad}else{if(D<=0){l.css(E,"-"+f*u+"px");D=f}}}if(j){if(B){if(D>=g){return}D+=g-D==lastScroll?lastScroll:s;m(D)}else{if(D<=0){return}D-=D==lastScroll?lastScroll:s;m(D)}}})}if(b.continuous&&n){o()}function o(){var G=f;var J=q.slice(G-r,G).clone().prependTo(l);var H=q.slice(0,r).clone().appendTo(l);G+=r*2;D=ad=r;g+=r*2;var I={};I[p]=G*u+"px";I[E]="-"+ad*u+"px";l.css(I)}if(v){l.bind("click",function(H){H=H||window.event;var G=H.target||H.srcElement;if(G.nodeName.toLowerCase()=="img"){z(a(G).attr("pic"))}});z(q.eq(0).find("img").attr("pic"))}function z(H){var G=new Image;G.onload=function(){v.html("").append(this);if(b.preOnload){b.preOnload.call(this)}else{}};G.src=H}})}})(jQuery);


