/*
 * jquery.tools 1.1.0 - The missing UI library for the Web
 * 
 * [tools.scrollable-1.1.0, tools.scrollable.circular-1.0.0, tools.scrollable.autoscroll-1.0.0]
 * 
 * Copyright (c) 2009 Tero Piirainen
 * http://flowplayer.org/tools/
 *
 * Dual licensed under MIT and GPL 2+ licenses
 * http://www.opensource.org/licenses
 * 
 * -----
 * 
 * File generated: Wed Aug 26 06:23:01 EDT 2009
 */
(function(b){b.tools=b.tools||{};b.tools.scrollable={version:"1.1.0",conf:{size:5,vertical:false,speed:400,keyboard:true,keyboardSteps:null,disabledClass:"disabled",hoverClass:null,clickable:true,activeClass:"active",easing:"swing",items:".items",item:null,prev:".prev",next:".next",prevPage:".prevPage",nextPage:".nextPage",api:false}};var c;function d(g,e){var f=b(g);return f.length==1?f:e.siblings(g)}function a(p,m){var r=this;if(!c){c=r}function n(s,t){b(r).bind(s,function(v,u){if(t&&t.call(this,u.index)===false&&u){u.proceed=false}});return r}b.each(m,function(s,t){if(b.isFunction(t)){n(s,t)}});var e=!m.vertical;var f=p.children();if(f.length>1){f=b(m.items,p)}var l=0;var g=d(m.prev,p);var j=d(m.next,p);var i=d(m.prevPage,p);var o=d(m.nextPage,p);var h;b.extend(r,{getIndex:function(){return l},getConf:function(){return m},getSize:function(){return r.getItems().size()},getPageAmount:function(){return Math.ceil(this.getSize()/m.size)},getPageIndex:function(){return Math.ceil(l/m.size)},getNaviButtons:function(){return g.add(j).add(i).add(o)},getRoot:function(){return p},getItemWrap:function(){return f},getItems:function(){return f.children(m.item)},getVisibleItems:function(){return r.getItems().slice(l,l+m.size)},seekTo:function(s,w,t){if(w===undefined){w=m.speed}if(b.isFunction(w)){t=w;w=m.speed}if(s<0){s=0}if(s>r.getSize()-m.size){return this.end()}var u=r.getItems().eq(s);if(!u.length){return r}var v={index:s,proceed:true};b(r).trigger("onBeforeSeek",v);if(!v.proceed){return r}function x(){if(t){t.call(r)}b(r).trigger("onSeek",v)}if(e){f.animate({left:-u.position().left},w,m.easing,x)}else{f.animate({top:-u.position().top},w,m.easing,x)}if(s===0){g.add(i).addClass(m.disabledClass)}else{g.add(i).removeClass(m.disabledClass)}if(s>=r.getSize()-m.size){j.add(o).addClass(m.disabledClass)}else{j.add(o).removeClass(m.disabledClass)}c=r;l=s;return r},move:function(u,t,s){h=u>0;return this.seekTo(l+u,t,s)},next:function(t,s){return this.move(1,t,s)},prev:function(t,s){return this.move(-1,t,s)},movePage:function(w,v,u){h=w>0;var s=m.size*w;var t=l%m.size;if(t>0){s+=(w>0?-t:m.size-t)}return this.move(s,v,u)},prevPage:function(t,s){return this.movePage(-1,t,s)},nextPage:function(t,s){return this.movePage(1,t,s)},setPage:function(t,u,s){t-=this.getPageIndex();return this.movePage(t)},begin:function(t,s){return this.seekTo(0,t,s)},end:function(t,s){return this.seekTo(this.getSize()-m.size,t,s)},reload:function(){b(r).trigger("onReload",{});return r},onBeforeSeek:function(s){return n("onBeforeSeek",s)},onSeek:function(s){return n("onSeek",s)},onReload:function(s){return n("onReload",s)},focus:function(){c=r},click:function(u){var v=r.getItems().eq(u),s=m.activeClass,t=m.size;if(u<0||u>=r.getSize()){return r}if(t==1){if(u===0||u==r.getSize()-1){h=(h===undefined)?true:!h}return h===false?r.prev():r.next()}if(t==2){if(u==l){u--}r.getItems().removeClass(s);v.addClass(s);return r.seekTo(u,time,fn)}if(!v.hasClass(s)){r.getItems().removeClass(s);v.addClass(s);var x=Math.floor(t/2);var w=u-x;if(w>r.getSize()-t){w=r.getSize()-t}if(w!==u){return r.seekTo(w)}}return r}});g.addClass(m.disabledClass).click(function(){r.prev()});j.click(function(){r.next()});o.click(function(){r.nextPage()});i.addClass(m.disabledClass).click(function(){r.prevPage()});var k=m.hoverClass,q="keydown."+Math.random().toString().substring(10);r.onReload(function(){if(k){r.getItems().hover(function(){b(this).addClass(k)},function(){b(this).removeClass(k)})}if(m.clickable){r.getItems().each(function(s){b(this).unbind("click.scrollable").bind("click.scrollable",function(t){if(b(t.target).is("a")){return}return r.click(s)})})}if(m.keyboard){b(document).bind(q,function(t){if(t.altKey||t.ctrlKey){return}if(m.keyboard!="static"&&c!=r){return}var u=m.keyboardSteps;if(e&&(t.keyCode==37||t.keyCode==39)){r.move(t.keyCode==37?-u:u);return t.preventDefault()}if(!e&&(t.keyCode==38||t.keyCode==40)){r.move(t.keyCode==38?-u:u);return t.preventDefault()}return true})}else{b(document).unbind(q)}});r.reload()}b.fn.scrollable=function(e){var f=this.eq(typeof e=="number"?e:0).data("scrollable");if(f){return f}var g=b.extend({},b.tools.scrollable.conf);b.extend(g,e);g.keyboardSteps=g.keyboardSteps||g.size;this.each(function(){f=new a(b(this),g);b(this).data("scrollable",f)});return g.api?f:this}})(jQuery);
(function(b){var a=b.tools.scrollable;a.plugins=a.plugins||{};a.plugins.circular={version:"1.0.0",conf:{api:false}};b.fn.circular=function(d){var c=b.extend({},a.plugins.circular.conf);b.extend(c,d);this.each(function(){var j=b(this).scrollable(),e=j.getItems(),h=j.getConf(),i=j.getItemWrap(),g=0;if(e.length<h.size){return false}e.slice(0,h.size).each(function(k){b(this).clone().appendTo(i).click(function(){j.click(e.length+k)})});var f=b.makeArray(e.slice(-h.size)).reverse();b(f).each(function(k){b(this).clone().prependTo(i).click(function(){j.click(-k-1)})});j.seekTo(h.size,0);b.extend(j,{move:function(n,m,l){var p=g+n+h.size;var o=p>j.getSize()-h.size;if(p<0||o){var k=g+h.size+(o?-e.length:e.length);j.seekTo(k,0);p=k+n}return j.seekTo(p,m,l)},begin:function(l,k){return this.seekTo(h.size,l,k)},end:function(l,k){return this.seekTo(e.length,l,k)},click:function(k,m,l){if(h.size==1){return this.next()}var n=k-g;n-=Math.floor(h.size/2);return this.move(n,m,l)},getIndex:function(){if(g<0){return e.length+g}if(g>=e.length){return 0}return g},getPageAmount:function(){return Math.ceil(e.length/h.size)},getPageIndex:function(){var k=j.getIndex();return Math.ceil((k-k%h.size)/h.size)}});j.onSeek(function(k){g=k-h.size;j.getNaviButtons().removeClass(h.disabledClass)})});return c.api?this.slice(-1).scrollable():this}})(jQuery);
(function(b){var a=b.tools.scrollable;a.plugins=a.plugins||{};a.plugins.autoscroll={version:"1.0.0",conf:{autoplay:true,interval:3000,autopause:true,steps:1,api:false}};b.fn.autoscroll=function(c){if(typeof c=="number"){c={interval:c}}var d=b.extend({},a.plugins.autoscroll.conf);b.extend(d,c);this.each(function(){var f=b(this).scrollable();var h,e,g=true;f.play=function(){if(h){return}g=false;h=setInterval(function(){f.move(d.steps)},d.interval);f.move(d.steps)};f.pause=function(){h=clearInterval(h)};f.stop=function(){f.pause();g=true};if(d.autopause){f.getRoot().add(f.getNaviButtons()).hover(function(){f.pause();clearInterval(e)},function(){if(!g){e=setTimeout(f.play,d.interval)}})}if(d.autoplay){setTimeout(f.play,d.interval)}});return d.api?this.slice(-1).scrollable():this}})(jQuery);
