!function(t){t.fn.marquee=function(i){function a(t,i,a){var e=a.behavior,r=a.width,s=a.dir;return"alternate"==e?1==t?i[a.widthAxis]-2*r:r:"slide"==e?-1==t?-1==s?i[a.widthAxis]:r:-1==s?i[a.widthAxis]-2*r:0:-1==t?i[a.widthAxis]:0}function e(){for(var i=r.length,s=null,d=null,l={},o=[],n=!1;i--;)s=r[i],d=t(s),l=d.data("marqueeState"),!0!==d.data("paused")?(s[l.axis]+=l.scrollamount*l.dir,n=-1==l.dir?s[l.axis]<=a(-1*l.dir,s,l):s[l.axis]>=a(-1*l.dir,s,l),"scroll"==l.behavior&&l.last==s[l.axis]||"alternate"==l.behavior&&n&&-1!=l.last||"slide"==l.behavior&&n&&-1!=l.last?("alternate"==l.behavior&&(l.dir*=-1),l.last=-1,d.trigger("stop"),l.loops--,0===l.loops?("slide"!=l.behavior?s[l.axis]=a(l.dir,s,l):s[l.axis]=a(-1*l.dir,s,l),d.trigger("end")):(o.push(s),d.trigger("start"),s[l.axis]=a(l.dir,s,l))):o.push(s),l.last=s[l.axis],d.data("marqueeState",l)):o.push(s);r=o,r.length&&setTimeout(e,25)}var r=[],s=this.length;return this.each(function(d){var l=t(this),o=l.attr("width")||l.width(),n=l.attr("height")||l.height(),h=l.after("<div "+(i?'class="'+i+'" ':"")+'style="display: block-inline; width: '+o+"px; height: "+n+'px; overflow: hidden;"><div style="float: left; white-space: nowrap;">'+l.html()+"</div></div>").next(),u=h.get(0),p=(l.attr("direction")||"left").toLowerCase(),c={dir:/down|right/.test(p)?-1:1,axis:/left|right/.test(p)?"scrollLeft":"scrollTop",widthAxis:/left|right/.test(p)?"scrollWidth":"scrollHeight",last:-1,loops:l.attr("loop")||-1,scrollamount:l.attr("scrollamount")||this.scrollAmount||2,behavior:(l.attr("behavior")||"scroll").toLowerCase(),width:/left|right/.test(p)?o:n};-1==l.attr("loop")&&"slide"==c.behavior&&(c.loops=1),l.remove(),/left|right/.test(p)?h.find("> div").css("padding","0 "+o+"px"):h.find("> div").css("padding",n+"px 0"),h.bind("stop",function(){h.data("paused",!0)}).bind("pause",function(){h.data("paused",!0)}).bind("start",function(){h.data("paused",!1)}).bind("unpause",function(){h.data("paused",!1)}).data("marqueeState",c),r.push(u),u[c.axis]=a(c.dir,u,c),h.trigger("start"),d+1==s&&e()}),t(r)}}(jQuery);