		var EternalSlider = new Class({
			Implements: [Options, Events],			
			options: {
				elementsType: '',
				elementsClass: 'item',
				nextButton: 'nextButton',
				previousButton: 'previousButton',
				mode: 'horizontal',
				paused: false,
				itemsSpread: 400,
				duration: 1000,
				itemMoveButtonClass: 'moveButton',
				offsetLeft: 400,
				itemOnShow: function(elem, slider){
					slider.isMoving = false;
				},
				itemOnHide: function(elem, slider){
					slider.goMove();
				}
			},
			initialize: function(container, options){
				this.setOptions(options);
				this.container = document.id(container);
				this.isMoving = false;
				this.elements = this.container.getElements(this.options.elementsType+'.'+this.options.elementsClass);
				this.currentPosition = this.realElementsLength = this.elements.length;
				if(this.elements.length>0){
					 
					this.elements.each(function(element, index){
						var clone1 = element.clone();
						var clone2 = element.clone();
						element.idx = index;
						clone1.idx = this.realElementsLength + index;
						clone2.idx = 2*this.realElementsLength + index;
						this.elements[clone1.idx] = clone1;
						this.elements[clone2.idx] = clone2;
					}.bind(this));
					this.elementComputedSize = this.elements[0].getComputedSize({styles: ['border','padding','margin']})[this.options.mode == 'horizontal' ? 'totalWidth' : 'totalHeight'];
					this.movable = new Element('div', {
						styles: {
							position: 'relative'
						}
					}).adopt(this.elements).inject(this.container, 'top');
					this.startPosition = -(this.realElementsLength*this.elementComputedSize - this.options.offsetLeft);
					this.moveProperty = this.options.mode == 'horizontal' ? 'left' : 'top';
					this.movable.setStyle(this.options.mode == 'horizontal' ? 'width' : 'height', this.elements.length*this.elementComputedSize);
					this.moveTween = new Fx.Tween(this.movable,{
						link : 'cancel',
						duration: this.options.duration,
						fps: 60,
						transition: 'expo:in:out',
						onComplete: function(){
							this.elements[this.currentPosition].getElement('div.'+this.options.itemMoveButtonClass).setStyle('display', 'none');
						}.bind(this)
					}).set(this.moveProperty, this.startPosition);
					this.container.addEvent('click', function(event){
						event = new Event(event);
						var target = $(event.target);
/*						if(target.get('class') == this.options.elementsClass){*/
						if(target.get('class') == this.options.itemMoveButtonClass){
							if(target.idx != this.currentPosition){
/*								var s = target.idx;*/
								var s = target.getParent().idx;
								this.showNext(s);
							}
						}
					}.bind(this));
					
					$(this.options.previousButton).addEvents({
						'click' : this.showPrevious.bind(this)
					});
					$(this.options.nextButton).addEvents({
						'click' : function(){
							$clear(this.intervalID);
							this.showNext();
							this.intervalID = this.showNext.periodical(7000, this);
						}.bind(this)
					});
				}
				this.moveTween.fireEvent('complete');
				this.options.itemOnShow(this.elements[this.currentPosition], this);
				if(!this.options.paused){
					this.intervalID = this.showNext.periodical(7000, this);

				}
				this.container.addEvents({
					'mouseenter': function(){
						$clear(this.intervalID);
					}.bind(this),
					'mouseleave': function(){
						$clear(this.intervalID);
						this.intervalID = this.showNext.periodical(7000, this);
					}.bind(this)
				});
			},
			showNext: function(idx, fromPaging){
				this.holdIt = this.currentPosition;
				if(fromPaging){
					idx = idx + (Math.ceil(this.currentPosition/(this.realElementsLength-1)) - 1)*this.realElementsLength;
				}
				if(!this.isMoving){
					this.isMoving = true;
					if(idx >= 0){
						this.currentPosition	= idx;
					}
					else{
						this.currentPosition++;
						
					}
					this.elements[this.holdIt].getElement('div.'+this.options.itemMoveButtonClass).setStyle('display', 'block')
					this.options.itemOnHide(this.elements[this.holdIt], this);
				}
			},
			showPrevious: function(){
				if(!this.isMoving){
					$clear(this.intervalID);
					this.showNext(this.currentPosition-1);
					this.intervalID = this.showNext.periodical(7000, this);
				}
			},
			toElement: function(){
				return this.container;
			},
			goMove: function(){
					this.newPosition =  - (this.currentPosition*this.elementComputedSize -this.options.offsetLeft);
					if(this.movable.getStyle('width').toInt() + this.newPosition < this.container.getStyle('width').toInt()){
						this.currentPosition = this.currentPosition - this.realElementsLength;
						this.movable.setStyle(this.moveProperty, -((this.holdIt-this.realElementsLength)*this.elementComputedSize-this.options.offsetLeft));
						this.newPosition = - (this.currentPosition*this.elementComputedSize - this.options.offsetLeft);
					}
					else if(this.newPosition > 0){
						this.currentPosition = this.realElementsLength;
						this.movable.setStyle(this.moveProperty, - ((this.realElementsLength+1)*this.elementComputedSize-this.options.offsetLeft));
						this.newPosition = - (this.currentPosition*this.elementComputedSize-this.options.offsetLeft);
					}
				
				
				this.moveTween.start(this.moveProperty, this.newPosition);	
				this.options.itemOnShow(this.elements[this.currentPosition], this);
			}
		});