var Ticker = new Class({
	Implements : [Options],
		options : {
			speed: 4000,
			delay: 1
		},
	
	initialize: function(el){
		this.el = $(el).addEvents({
		   'mouseover' : this.over.bind(this),
		   'mouseout' : this.out.bind(this)
		});
		
		this.items = this.el.getElements('li');
		var w = 0;
		var h = 0;
		
		h = this.el.getSize().y;
		this.items.each(function(li,index) {
			w += li.getSize().x;
		});
		
		this.el.setStyles({
			position: 'absolute',
			top: 0,
			left: 0,
			width: w,
			height: h
		});

		this.fx = new Fx.Morph(this.el,{duration:this.options.speed, transition: Fx.Transitions.linear,onComplete:function() {
			var i = (this.current==0)?this.items.length:this.current;
			this.items[i-1].injectInside(this.el);
			this.el.setStyles({
				left:0,
				top:0
			});
			this.next();
		}.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
		});
	},
	
	over : function(){
		this.fx.pause();
		$clear(this.timeoutId);
	},
	
	out : function(){
	   this.fx.resume();
	}
	
});
var TickerNew = new Class({
	Implements : [Options],
		options : {
			speed: 4000,
			delay: 1
		},
	
	initialize: function(el){
		
		this.el = $(el);
		
		this.items = this.el.getElements('li');
		var w = 0;
		var h = 0;
		var html = '';
		
		w = this.el.getSize().x;
		h = this.el.getSize().y;
	
		var inner = new Element('div');
		this.items.each(function(li,index) {
			var span = new Element('span', {
				'html': li.get('html')
			}).inject(inner);
		});
	
		var outer = new Element('div', {
			'styles': {
				'width': 850,
				'height': 20,
				'overflow': 'scroll'
			},
			'class': 'ticker'
		}).adopt(inner).replaces(el);
		
		/*		
		this.el.setStyles({
			position: 'absolute',
			top: 0,
			left: 0,
			width: w,
			height: h
		});

		this.fx = new Fx.Morph(this.el,{duration:this.options.speed, transition: Fx.Transitions.linear,onComplete:function() {
			var i = (this.current==0)?this.items.length:this.current;
			this.items[i-1].injectInside(this.el);
			this.el.setStyles({
				left:0,
				top:0
			});
			this.next();
		}.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
		});
		*/
	},
	
	over : function(){
		/*
		this.fx.pause();
		$clear(this.timeoutId);
		*/
	},
	
	out : function(){
	   /*
	   this.fx.resume();
	   */
	}
});
