var ni_slide = new Class({
	initialize: function(items,options){
		if(options) for(var o in options) this[o]=options[o];
		this._current = 0;
		this._previous = null;
		this.items = items.setStyle('float','left');
		this.disabled = false;
		this.timer = null;
		this.inhalt=$('maske-inhalt');
	},
	walk: function(n,manual){
    var dd='';
		if(this._current!==n && !this.disabled){
			this.disabled = true;
			if(manual){this.stop();}
			this._previous = this._current;
			this._current = n;
// ###############################################
    this.inhalt.set('morph',{
                               duration: 1000, 
                               transition: Fx.Transitions.Back.easeInOut,
                               onComplete:this.onComplete.bind(this) 
                              }
                      ).morph({ 'left': [this._previous*-920, this._current*-920]}); 
// ###############################################
		}
	},
	play: function(wait){
		this.stop();
		if(!wait){this.next();}
		this.timer = this.next.periodical('5000',this,[false]);
	},
	stop: function(){$clear(this.timer);},
	next: function(manual){
	  if(this._current+1 < this.items.length){ this.walk(this._current+1,manual); }
          else { this.walk(0,manual); }
	},
	onComplete: function(){
		this.disabled = false;
		if(this.onWalk) this.onWalk(this._current);
	} 
});
