var sonoTicker = new Class({
	Implements: Options,
	options: {
		speed: 5000,
		delay: 5000,
		direction: 'vertical',
		pauzeOnHover: 'false', 
		onComplete: Class.empty,
		onStart: Class.empty
	},
	initialize: function(container, options) { 
		this.setOptions(options);
		this.container = container;
		this.speed = this.options.speed;
		this.delay = this.options.delay;
		this.direction = this.options.direction;
		this.pauzeOnHover = this.options.pauzeOnHover;
		this.onComplete = this.options.onComplete;
		this.onStart = this.options.onStart;
		this.items = this.container.getChildren('li');
		
		var w = 0;
		var h = 0;
		
		if (this.direction == 'horizontal') {
			h = this.container.getSize().y;
			this.items.each(function(li, index) {
				w += li.getSize().x;
			});
		} else {
			w = this.container.getSize().x;
			this.items.each(function(li, index) {
				h += li.getSize().y;
			});
		}

		this.container.setStyles({
			position: 'relative',
			top: 0,
			left: 0,
			width: w,
			height: h
		});
		
		this.fx = new Fx.Morph(this.container, {
			duration: this.options.speed,
			onComplete: function() {
				var i = (this.current==0) ? this.items.length : this.current;
				this.items[i-1].injectInside(this.container);
				this.container.setStyles({
					left: 0,
					top: 0
				});
			}.bind(this)
		});
		this.current = 0;
		this.next();
	},
	next: function() {
		this.current++;
		if (this.current >= this.items.length) {
			this.current = 0;
		}
		var pos = this.items[this.current];
		this.fx.start({
			top: -pos.offsetTop,
			left: -pos.offsetLeft
		});
		this.next.bind(this).delay(this.options.delay+this.options.speed);
	}
});
