(function(a){a.fn.kxbdsupermarquee=function(c){var b=a.extend({},a.fn.kxbdsupermarquee.defaults,c);return this.each(function(){var v=a(this);var a=v.get(0);var z=v.width();var k=v.height();var l=v.children();var x=l.children();var j=0;var f=(b.direction=="left"||b.direction=="right")?1:0;var o,m,p,h;var f,n,o,s,t;var g,r;var h,q;var u=[];var g=0;var d=0;var l=0;l.css(f?"width":"height",10000);var y="
";if(b.isequal){g=x[f?"outerwidth":"outerheight"]();r=x.length;j=g*r;for(var j=0;j"+(j+1)+""}}else{x.each(function(b){u.push(j);j+=a(this)[f?"outerwidth":"outerheight"]();y+="- "+(b+1)+"
"})}y+="
";if(j<(f?z:k)){return}l.append(x.clone()).css(f?"width":"height",j*2);if(b.navid){h=a(b.navid).append(y).hover(k,n);q=a("li",h);q.each(function(b){a(this).bind(b.eventnav,function(){if(p){return}if(g==b){return}m(u[b]);q.eq(g).removeclass("navon");g=b;a(this).addclass("navon")})});q.eq(g).addclass("navon")}if(b.direction=="right"||b.direction=="down"){a[f?"scrollleft":"scrolltop"]=j}else{a[f?"scrollleft":"scrolltop"]=0}if(b.ismarquee){h=settimeout(i,b.scrolldelay);v.hover(function(){clearinterval(h)},function(){clearinterval(h);h=settimeout(i,b.scrolldelay)});if(b.controlbtn){a.each(b.controlbtn,function(b,c){a(c).bind(b.eventa,function(){b.direction=b;b.oldamount=b.scrollamount;b.scrollamount=b.newamount}).bind(b.eventb,function(){b.scrollamount=b.oldamount})})}}else{if(b.isauto){n();v.hover(k,n)}if(b.btngo){a.each(b.btngo,function(b,c){a(c).bind(b.eventgo,function(){if(p==true){return}b.direction=b;m();if(b.isauto){k();n()}})})}}function i(){var b=(b.direction=="left"||b.direction=="right")?"scrollleft":"scrolltop";if(b.ismarquee){if(b.loop>0){l+=b.scrollamount;if(l>j*b.loop){a[b]=0;return clearinterval(h)}}var c=a[b]+(b.direction=="left"||b.direction=="up"?1:-1)*b.scrollamount}else{if(b.duration){if(f++=j){c-=j}}else{if(c<=0){c+=j}}a[b]=c;if(b.ismarquee){h=settimeout(i,b.scrolldelay)}else{if(f=r){g=0}else{if(g<0){g=r-1}}q.eq(g).addclass("navon");d=g}var e=d<0?j:0;f=0;n=a[b];t=(d!=undefined)?d:e+(b.distance*d)%j;if(c==1){if(t>n){o=t-n}else{o=t+j-n}}else{if(t>n){o=t-j-n}else{o=t-n}}s=b.duration;if(o){cleartimeout(o)}o=settimeout(i,b.scrolldelay)}function n(){m=setinterval(function(){m()},b.time*1000)}function k(){clearinterval(m)}function w(p,i,q,e){return -q*(p/=e)*(p-2)+i}function e(p,i,q,e){return q*((p=p/e-1)*p*p*p*p+1)+i}})};a.fn.kxbdsupermarquee.defaults={ismarquee:false,isequal:true,loop:0,newamount:3,eventa:"mousedown",eventb:"mouseup",isauto:true,time:5,duration:50,eventgo:"click",direction:"left",scrollamount:1,scrolldelay:10,eventnav:"click"};a.fn.kxbdsupermarquee.setdefaults=function(b){a.extend(a.fn.kxbdsupermarquee.defaults,b)}})(jquery);