/**
 * jquery.scrollable 0.13. Put your HTML scroll.
 * 
 * http://flowplayer.org/tools/scrollable.html
 *
 * Copyright (c) 2008 Tero Piirainen (support@flowplayer.org)
 *
 * Released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * >> Basically you can do anything you want but leave this header as is <<
 *
 * Since  : 0.10 - 03/01/2008
 * Version: 0.13 - Wed Nov 05 2008 12:04:03 GMT-0000 (GMT+00:00)
 */
 (function($) {

$.event.special.mousewheel = {
	setup: function() {
		var handler = $.event.special.mousewheel.handler;
		
		// Fix pageX, pageY, clientX and clientY for mozilla
		if ( $.browser.mozilla )
			$(this).bind('mousemove.mousewheel', function(event) {
				$.data(this, 'mwcursorposdata', {
					pageX: event.pageX,
					pageY: event.pageY,
					clientX: event.clientX,
					clientY: event.clientY
				});
			});
	
		if ( this.addEventListener )
			this.addEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
		else
			this.onmousewheel = handler;
	},
	
	teardown: function() {
		var handler = $.event.special.mousewheel.handler;
		
		$(this).unbind('mousemove.mousewheel');
		
		if ( this.removeEventListener )
			this.removeEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
		else
			this.onmousewheel = function(){};
		
		$.removeData(this, 'mwcursorposdata');
	},
	
	handler: function(event) {
		var args = Array.prototype.slice.call( arguments, 1 );
		
		event = $.event.fix(event || window.event);
		// Get correct pageX, pageY, clientX and clientY for mozilla
		$.extend( event, $.data(this, 'mwcursorposdata') || {} );
		var delta = 0, returnValue = true;
		
		if ( event.wheelDelta ) delta = event.wheelDelta/120;
		if ( event.detail     ) delta = -event.detail/3;
		if ( $.browser.opera  ) delta = -event.wheelDelta;
		
		event.data  = event.data || {};
		event.type  = "mousewheel";
		
		// Add delta to the front of the arguments
		args.unshift(delta);
		// Add event to the front of the arguments
		args.unshift(event);

		return $.event.handle.apply(this, args);
	}
};

$.fn.extend({
	mousewheel: function(fn) {
		return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
	},
	
	unmousewheel: function(fn) {
		return this.unbind("mousewheel", fn);
	}
});

})(jQuery);
 
(function($) {
		
	// constructor
	function Scrollable(el, config) {   
		
		// current instance
		var self = this;  
		
		if (!Scrollable.current) {
			Scrollable.current = this;	
		}
		
		var opts = {								
			size: 5,
			vertical:false,				
			activeClass:'active',
			speed: 300,
			onSeek: null,
			clickable: true,
			
			// jquery selectors
			items: '.items',
			prev:'.prev',
			next:'.next',
			navi:'.navi',
			naviItem:'span', 
			loop: false
		}; 

		
		this.opts = $.extend(opts, config);  
		this.opts.horizontal = !opts.vertical;
		
		// root / itemRoot
		this.root = $(el);
		var root = this.root;
		var itemRoot = $(opts.items, root);			
		if (!itemRoot.length)  { itemRoot = root; }  
		
		
		// wrap itemRoot.children() inside container
		itemRoot.css({position:'relative', overflow:'hidden', visibility:'visible'});
		itemRoot.children().wrapAll('<div class="__scrollable" style="position:absolute"/>'); 
		
		this.wrap = itemRoot.find(":first");
		this.wrap.css(opts.horizontal ? "width" : "height", "200000em").after('<br clear="all" />');		
		this.items = this.wrap.children();
		this.index = 0;

		
		// set dimensions based on offsets of the two first elements
		if (opts.horizontal) {
			itemRoot.width(opts.size * (this.items.eq(1).offset().left - this.items.eq(0).offset().left) -2);	
		} else {
			itemRoot.height(opts.size * (this.items.eq(1).offset().top - this.items.eq(0).offset().top) -2);	
		} 

		// mousewheel
		if ($.isFunction($.fn.mousewheel)) { 
			root.bind("mousewheel.scrollable", function(e, delta)  { 
				self.move(-delta, 50);		
				return false;
			});
		}  
		
		// item.click()
		if (opts.clickable) {
			this.items.each(function(index, arg) {
				$(this).bind("click.scrollable", function() {
					self.click(index);		
				});
			});				
		}


		this.activeIndex = 0;
		
		// prev
		$(opts.prev, root).click(function() { 
			self.prev(); 
		});
		

		// next
		$(opts.next, root).click(function() { 
			self.next(); 
		});
		

		// navi 			
		$(opts.navi, root).each(function() { 				
			var navi = $(this);
			
			var status = self.getStatus();
			
			// generate new entries
			if (navi.is(":empty")) {
				for (var i = 0; i < status.pages; i++) {		
					
					var item = $("<" + opts.naviItem + "/>").attr("page", i).click(function(e) {							
						var el = $(this);
						el.parent().children().removeClass(opts.activeClass);
						el.addClass(opts.activeClass);
						self.setPage(el.attr("page"));
						e.preventDefault();
					});
					
					if (i === 0) { item.addClass(opts.activeClass); }
					navi.append(item);					
				}
				
			// assign onClick events to existing entries
			} else {
				
				// find a entries first -> syntaxically correct
				var els = navi.find("a");
				
				if (!els.length) { 
					els = navi.children(); 
				}
				
				els.each(function(i)  {
					var item = $(this);
					item.attr("page", i);
					if (i === 0) { item.addClass(opts.activeClass); }
					
					item.click(function() {
						navi.find("." + opts.activeClass).removeClass(opts.activeClass);
						item.addClass(opts.activeClass);
						self.setPage(item.attr("page"));
					});
					
				});
			}
			
		});			
	} 
	
	
	// methods
	$.extend(Scrollable.prototype, {  
			
			
		getVersion: function() {
			return '@VERSION';	
		},

		click: function(index) {
			
			var item = this.items.eq(index);
			var klass = this.opts.activeClass;			
			
			if (!item.hasClass(klass) && (index >= 0 || index < this.items.size())) {				
				this.items.removeClass(klass);
				item.addClass(klass);
				var delta = Math.floor(this.opts.size / 2);
				var to = index - delta;

				if (to !== this.activeIndex) {
					this.seekTo(to);		
				}				 
			} 
		},
		
		
		getStatus: function() {
			var len =  this.items.size();
			return {
				size: this.opts.size,
				total: len, 
				index: this.index,  
				pages: Math.ceil(len / this.opts.size),
				page: Math.ceil(this.index / this.opts.size)
			};
		}, 

		
		// all other seeking functions depend on this generic seeking function		
		seekTo: function(index, time) {
			
			if (index < 0) { index = 0; }
			var max = Math.min(index, this.items.length - this.opts.size);  			
			
			if (index <= max) { 
				
				var item = this.items.eq(index);			
				this.index = index;	

				if (this.opts.horizontal) {
					var left = this.wrap.offset().left - item.offset().left;				
					this.wrap.animate({left: left}, time || this.opts.speed);
					
				} else {
					var top = this.wrap.offset().top - item.offset().top;					
					this.wrap.animate({top: top}, time || this.opts.speed);							
				}
				
				Scrollable.current = this; 
			} 
			

			// custom onSeek callback
			if ($.isFunction(this.opts.onSeek)) {
				this.opts.onSeek.call(this);
			}
			
			// navi status update
			var navi = $(this.opts.navi, this.root);
			
			if (navi.length) {
				var klass = this.opts.activeClass;
				var page = Math.ceil(index / this.opts.size);
				page = Math.min(page, navi.children().length - 1);
				navi.children().removeClass(klass).eq(page).addClass(klass);
			} 
			
			this.activeIndex = index;			
			return true; 
		},
		
			
		move: function(offset, time) {
			var to = this.index + offset;
			if (this.opts.loop && to > (this.items.length - this.opts.size)) {
				to = 0;	
			}
			this.seekTo(to, time);
		},
		
		next: function(time) {
			this.move(1, time);	
		},
		
		prev: function(time) {
			this.move(-1, time);	
		},
		
		movePage: function(offset, time) {
			this.move(this.opts.size * offset, time);		
		},
		
		setPage: function(page, time) {
			var size = this.opts.size;
			var index = size * page;
 			var lastPage = index + size >= this.items.size(); 
			if (lastPage) {
				index = this.items.size() - this.opts.size;
			}
			this.seekTo(index, time);
		},
		
		prevPage: function(time) {
			this.setPage(this.getStatus().page - 1, time);
		},  

		nextPage: function(time) {
			this.setPage(this.getStatus().page + 1, time);
		}, 
		
		begin: function(time) {
			this.seekTo(0, time);	
		},
		
		end: function(time) {
			this.seekTo(this.items.size() - this.opts.size, time);	
		}
		
	});  
	
	
	
	// keyboard
	$(window).bind("keypress.scrollable", function(evt) {
		
		var el = Scrollable.current;	
		if (!el) { return; }
			
		if (el.opts.horizontal && (evt.keyCode == 37 || evt.keyCode == 39)) {
			el.move(evt.keyCode == 37 ? -1 : 1);
			return evt.preventDefault();
		}	
		
		if (!el.opts.horizontal && (evt.keyCode == 38 || evt.keyCode == 40)) {
			el.move(evt.keyCode == 38 ? -1 : 1);
			return evt.preventDefault();
		}
		
		return true;
		
	});	
		
	// jQuery plugin implementation
	jQuery.prototype.scrollable = function(opts, arg0, arg1) { 
			
		// return API associated with this instance
		if (!opts || typeof opts == 'number') {
			var index = opts || 0;
			var el = $.data(this.get()[index], "scrollable");
			if (el) { return el; }
		}
		
		this.each(function() {
				
			// @deprecated way of accessing API
			if (typeof opts == "string") {
				var el = $.data(this, "scrollable");
				el[opts].apply(el, [arg0, arg1]);
				
			// create new Scrollable instance
			} else { 
				var instance = new Scrollable(this, opts);	
				$.data(this, "scrollable", instance);
			}
		});
		
		return this;
	};
			
	
})(jQuery);

 
//eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){6 t(l,k){4 g=3;7(!t.Q){t.Q=3}4 m={9:5,18:U,o:\'27\',10:21,Y:1Y,1e:V,n:\'.n\',J:\'.J\',H:\'.H\',M:\'.M\',17:\'1x\',1c:U};3.8=$.13(m,k);3.8.F=!m.18;3.11=$(l);4 h=3.11;4 j=$(m.n,h);7(!j.E){j=h}j.1h({1g:\'20\',1X:\'1W\',1V:\'1U\'});j.y().1L(\'<1K 1J="1H" 1G="1g:1E"/>\');3.s=j.S(":1A");3.s.1h(m.F?"1l":"16","1w").1t(\'<1s 1q="1p" />\');3.n=3.s.y();3.C=0;7(m.F){j.1l(m.9*(3.n.x(1).q().K-3.n.x(0).q().K)-2)}R{j.16(m.9*(3.n.x(1).q().I-3.n.x(0).q().I)-2)}7($.1j($.22.1i)){h.Z("1i.u",6(e,a){g.w(-a,1Z);p U})}7(m.1e){3.n.P(6(a,b){$(3).Z("v.u",6(){g.v(a)})})}3.X=0;$(m.J,h).v(6(){g.J()});$(m.H,h).v(6(){g.H()});$(m.M,h).P(6(){4 b=$(3);4 f=g.O();7(b.1Q(":1N")){1M(4 i=0;i<f.1b;i++){4 c=$("<"+m.17+"/>").N("r",i).v(6(e){4 a=$(3);a.1I().y().L(m.o);a.z(m.o);g.G(a.N("r"));e.T()});7(i===0){c.z(m.o)}b.1F(c)}}R{4 d=b.S("a");7(!d.E){d=b.y()}d.P(6(i){4 a=$(3);a.N("r",i);7(i===0){a.z(m.o)}a.v(6(){b.S("."+m.o).L(m.o);a.z(m.o);g.G(a.N("r"))})})}})}$.13(t.19,{1D:6(){p\'@1C\'},v:6(d){4 c=3.n.x(d);4 e=3.8.o;7(!c.1B(e)&&(d>=0||d<3.n.9())){3.n.L(e);c.z(e);4 a=B.1z(3.8.9/2);4 b=d-a;7(b!==3.X){3.A(b)}}},O:6(){4 a=3.n.9();p{9:3.8.9,1y:a,C:3.C,1b:B.W(a/3.8.9),r:B.W(3.C/3.8.9)}},A:6(g,h){7(g<0){g=0}4 c=B.1d(g,3.n.E-3.8.9);7(g<=c){4 a=3.n.x(g);3.C=g;7(3.8.F){4 i=3.s.q().K-a.q().K;3.s.1a({K:i},h||3.8.10)}R{4 d=3.s.q().I-a.q().I;3.s.1a({I:d},h||3.8.10)}t.Q=3}7($.1j(3.8.Y)){3.8.Y.1v(3)}4 b=$(3.8.M,3.11);7(b.E){4 f=3.8.o;4 e=B.W(g/3.8.9);e=B.1d(e,b.y().E-1);b.y().L(f).x(e).z(f)}3.X=g;p V},w:6(c,a){4 b=3.C+c;7(3.8.1c&&b>(3.n.E-3.8.9)){b=0}3.A(b,a)},H:6(a){3.w(1,a)},J:6(a){3.w(-1,a)},1u:6(b,a){3.w(3.8.9*b,a)},G:6(b,a){4 d=3.8.9;4 e=d*b;4 c=e+d>=3.n.9();7(c){e=3.n.9()-3.8.9}3.A(e,a)},1O:6(a){3.G(3.O().r-1,a)},1P:6(a){3.G(3.O().r+1,a)},1r:6(a){3.A(0,a)},1R:6(a){3.A(3.n.9()-3.8.9,a)}});$(1S).Z("1T.u",6(a){4 b=t.Q;7(!b){p}7(b.8.F&&(a.D==15||a.D==1o)){b.w(a.D==15?-1:1);p a.T()}7(!b.8.F&&(a.D==14||a.D==1n)){b.w(a.D==14?-1:1);p a.T()}p V});1f.19.u=6(c,e,f){7(!c||1k c==\'1m\'){4 g=c||0;4 d=$.12(3.26()[g],"u");7(d){p d}}3.P(6(){7(1k c=="25"){4 b=$.12(3,"u");b[c].24(b,[e,f])}R{4 a=23 t(3,c);$.12(3,"u",a)}});p 3}})(1f);',62,132,'|||this|var||function|if|opts|size||||||||||||||items|activeClass|return|offset|page|wrap|Scrollable|scrollable|click|move|eq|children|addClass|seekTo|Math|index|keyCode|length|horizontal|setPage|next|top|prev|left|removeClass|navi|attr|getStatus|each|current|else|find|preventDefault|false|true|ceil|activeIndex|onSeek|bind|speed|root|data|extend|38|37|height|naviItem|vertical|prototype|animate|pages|loop|min|clickable|jQuery|position|css|mousewheel|isFunction|typeof|width|number|40|39|all|clear|begin|br|after|movePage|call|200000em|span|total|floor|first|hasClass|VERSION|getVersion|absolute|append|style|__scrollable|parent|class|div|wrapAll|for|empty|prevPage|nextPage|is|end|window|keypress|visible|visibility|hidden|overflow|null|50|relative|300|fn|new|apply|string|get|active'.split('|'),0,{}))