(function(b){b.fn.kxbdMarquee=function(a){var d=b.extend({},b.fn.kxbdMarquee.defaults,a);return this.each(function(){var w=b(this);w.css("overflow","hidden");w.wrapInner("<ul></ul>");var o=w.get(0);var c=w.width();var q=w.height();var x=w.children();if(x.children().length==0){x.wrapInner("<span></span>")}var v;var u=0;var r=(d.direction=="left"||d.direction=="right")?1:0;x.css(r?"width":"height",10000);while(b(this)[r?"outerWidth":"outerHeight"]()>u){v=x.children();v.css("float","left");if(d.isEqual){u=v[r?"outerWidth":"outerHeight"]()*v.length}else{v.each(function(){u+=b(this)[r?"outerWidth":"outerHeight"]()})}if(!u){return}if(!d.is_force_scroll&&u<(r?c:q)){return}x.append(v.clone()).css(r?"width":"height",u*2)}var p=0;function s(){var e=(d.direction=="left"||d.direction=="right")?"scrollLeft":"scrollTop";if(d.loop>0){p+=d.scrollAmount;if(p>u*d.loop){o[e]=0;return clearInterval(t)}}if(d.direction=="left"||d.direction=="up"){o[e]+=d.scrollAmount;if(o[e]>=u){o[e]=0}}else{o[e]-=d.scrollAmount;if(o[e]<=0){o[e]=u}}}var t=setInterval(s,d.scrollDelay);w.hover(function(){clearInterval(t)},function(){clearInterval(t);t=setInterval(s,d.scrollDelay)})})};b.fn.kxbdMarquee.defaults={isEqual:false,loop:0,direction:"left",scrollAmount:1,scrollDelay:20,is_force_scroll:true};b.fn.kxbdMarquee.setDefaults=function(a){b.extend(b.fn.kxbdMarquee.defaults,a)}})(jQuery);
