(function(n){n.fn.kxbdSuperMarquee=function(t){var i=n.extend({},n.fn.kxbdSuperMarquee.defaults,t);return this.each(function(){function d(){var r=i.direction=="left"||i.direction=="right"?"scrollLeft":"scrollTop",n;if(i.isMarquee){if(i.loop>0&&(ht+=i.scrollAmount,ht>t*i.loop))return a[r]=0,clearInterval(c);n=a[r]+(i.direction=="left"||i.direction=="up"?1:-1)*i.scrollAmount}else if(i.duration)if(v++
=t&&(n-=t):n<=0&&(n+=t);a[r]=n;i.isMarquee?c=setTimeout(d,i.scrollDelay):v
=w?r=0:r<0&&(r=w-1),l.eq(r).addClass("navOn"),b=r);c=b<0?t:0;v=0;e=a[s];u=n!=undefined?n:c+i.distance*b%t;y=o==1?u>e?u-e:u+t-e:u>e?u-t-e:u-e;p=i.duration;f&&clearTimeout(f);typeof i.beforeScroll=="function"&&i.beforeScroll(u/i.distance);f=setTimeout(d,i.scrollDelay)}function tt(){ot=setInterval(function(){ft()},i.time*1e3)}function et(){clearInterval(ot)}function at(n,t,i,r){return-i*(n/=r)*(n-2)+t}var o=n(this),a=o.get(0),ct=o.width(),lt=o.height(),it=o.children(),g=it.children(),t=0,s=i.direction=="left"||i.direction=="right"?1:0,f,ot,h,c,v,e,y,p,u,rt,w,st,l,ut=[],r=0,b=0,ht=0,k,nt;if(it.css(s?"width":"height",1e4),k="
",i.isEqual)for(rt=g[s?"outerWidth":"outerHeight"](),w=g.length,t=rt*w,nt=0;nt<\/li>";else g.each(function(i){ut.push(t);t+=n(this)[s?"outerWidth":"outerHeight"]();k+="- "+(i+1)+"<\/li>"});(k+="<\/ul>",t<(s?ct:lt))||(it.append(g.clone()).css(s?"width":"height",t*2),i.navId&&(st=n(i.navId).append(k).hover(et,tt),l=n("li",st),l.each(function(t){n(this).bind(i.eventNav,function(){h||r!=t&&(ft(ut[t]),l.eq(r).removeClass("navOn"),r=t,n(this).addClass("navOn"))})}),l.eq(r).addClass("navOn")),a[s?"scrollLeft":"scrollTop"]=i.direction=="right"||i.direction=="down"?t:0,i.isMarquee?(c=setTimeout(d,i.scrollDelay),o.hover(function(){clearInterval(c)},function(){clearInterval(c);c=setTimeout(d,i.scrollDelay)}),i.controlBtn&&n.each(i.controlBtn,function(t,r){n(r).bind(i.eventA,function(){i.direction=t;i.oldAmount=i.scrollAmount;i.scrollAmount=i.newAmount}).bind(i.eventB,function(){i.scrollAmount=i.oldAmount})})):(i.isAuto&&(tt(),o.hover(et,tt)),i.btnGo&&n.each(i.btnGo,function(t,r){n(r).bind(i.eventGo,function(){h!=!0&&(i.direction=t,ft(),i.isAuto&&(et(),tt()))})})))})};n.fn.kxbdSuperMarquee.defaults={isMarquee:!1,isEqual:!0,loop:0,newAmount:3,eventA:"mousedown",eventB:"mouseup",isAuto:!0,time:5,duration:50,eventGo:"click",direction:"left",scrollAmount:1,scrollDelay:10,eventNav:"click",beforeScroll:undefined};n.fn.kxbdSuperMarquee.setDefaults=function(t){n.extend(n.fn.kxbdSuperMarquee.defaults,t)}})(jQuery)