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