var smoothNews = new Class({	
	Implements: [Events, Options],
	version:3.0,
	options : {
		paddingLeft:10,
		containerWidth:600,
		containerHeight:150,
		transitionLength:2000,
		stopLength:2000,
		border:'1px solid #DDDDDD',
		transition:Fx.Transitions.Bounce.easeOut
	},
	initialize: function(container, options) {
		this.setOptions(options);
		this.gallery = new Element('div');
		this.minimoi = container.clone();
		container.empty();
		this.news = this.minimoi.getFirst('ul').getChildren('li');
		this.size = this.options.containerHeight*this.news.length;
		this.imagesNumber = 0;
		container.setStyles({
			border : this.options.border,
			width : this.options.containerWidth,
			height:this.options.containerHeight,
			overflow : 'hidden',
			position : 'absolute'
		});
		container.adopt(this.gallery);
		$each(this.news,function(item){
			this.gallery.setStyle('height',this.size);
			this.section = new Element('div');
			this.section.set('html',item.get('html'));
			this.section.setStyles({'padding-left':this.options.paddingLeft,'height':this.options.containerHeight,'width':this.options.containerWidth,'overflow':'hidden'});
			this.section.inject(this.gallery);
		}.bind(this));
		this.currentDirection= 0;
		this.curStep = 1;
		this.scroll = new Fx.Scroll(container, {
			duration: this.options.transitionLength,
			offset: {'x': 0, 'y': 0},
			transition:this.options.transition,
			onComplete:function(){
				if(this.curStep==this.news.length-1)
					this.currentDirection=1;
				else if(this.curStep==0)
					this.currentDirection=0;
				if(this.currentDirection==0)
					this.curStep++;
				else
					this.curStep--;
				(function(){
					this.scroll.start(0,this.options.containerHeight*this.curStep);
				}).delay(this.options.stopLength,this);
			}.bind(this)
		});
		(function(){
			this.scroll.start(0,this.options.containerHeight);
		}).delay(this.options.stopLength,this);
	}
});