/**
 * jQuery[a] - Animated scrolling of series
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 3/20/2008
 * @author Ariel Flesler
 * @version 1.2.1
 *
 * http://flesler.blogspot.com/2008/02/jqueryserialscroll.html
 */
;(function(a){var b=a.serialScroll=function(c){a.scrollTo.window().serialScroll(c)};b.defaults={duration:1000,axis:"x",event:"click",start:0,step:1,lock:true,cycle:true,constant:true};a.fn.serialScroll=function(d){d=a.extend({},b.defaults,d);var f=d.event,e=d.step,c=d.lazy;return this.each(function(){var j=d.target?this:document,h=a(d.target||this,j),l=h[0],t=d.items,o=d.start,u=d.interval,g=d.navigation,p="next",i;if(!c){t=k()}if(d.force){v({},o)}a(d.prev||[],j).bind(f,-e,m);a(d.next||[],j).bind(f,e,m);if(!l.ssbound){h.bind("prev.serialScroll",-e,m).bind("next.serialScroll",e,m).bind("goto.serialScroll",v)}if(u){h.bind("start.serialScroll",function(w){if(!u){q();u=true;p="next";r()}}).bind("startInverse.serialScroll",function(w){if(!u){q();u=true;p="prev";n()}}).bind("stop.serialScroll",function(){q();u=false})}h.bind("notify.serialScroll",function(y,x){var w=s(x);if(w>-1){o=w}});l.ssbound=true;if(d.jump){(c?h:k()).bind(f,function(w){v(w,s(w.target))})}if(g){g=a(g,j).bind(f,function(w){w.data=Math.round(k().length/g.length)*g.index(this);v(w,this)})}function m(w){w.data+=o;v(w,this)}function v(C,A){if(!isNaN(A)){C.data=A;A=l}var D=C.data,w,E=C.type,B=d.exclude?k().slice(0,-d.exclude):k(),z=B.length,x=B[D],y=d.duration;if(E){C.preventDefault()}if(u){q();if(p=="next"){i=setTimeout(r,d.interval)}else{if(p=="prev"){i=setTimeout(n,d.interval)}}}if(!x){w=D<0?0:z-1;if(o!=w){D=w}else{if(!d.cycle){return}else{D=z-w-1}}x=B[D]}if(!x||E&&o==D||d.lock&&h.is(":animated")||E&&d.onBefore&&d.onBefore.call(A,C,x,h,k(),D)===false){return}if(d.stop){h.queue("fx",[]).stop()}if(d.constant){y=Math.abs(y/e*(o-D))}h.scrollTo(x,y,d).trigger("notify.serialScroll",[D])}function r(){h.trigger("next.serialScroll")}function n(){h.trigger("prev.serialScroll")}function q(){clearTimeout(i)}function k(){return a(t,l)}function s(x){if(!isNaN(x)){return x}var y=k(),w;while((w=y.index(x))==-1&&x!=l){x=x.parentNode}return w}})}})(jQuery);




