var smartscroller = new Class({
	
	fieldArray: [],
	//implements
	Implements: [Options],

	//options
	options: {
		"showDuration":4000,
		"fadeDuration":false,
		"indice":0
	},
	
	// Inizializzazione
	initialize: function(options) {
		// Set options
		this.setOptions(options);
		indice = 0;
		elementi = $$("ul[rel=smartscroller] li");
		elementi.set("opacity", 0);
		/* Avvia! */
		window.addEvent('load',function() {
			this.nextRequest();
			this.nextRequest.periodical( this.options.showDuration );
		}.bind( this ) );
	},
	//
	nextRequest: function(){
		if( indice == elementi.length ){
			indice = 0;
		}
		$each( elementi, function(e, i){
			if( indice == i){
				(function(){ e.fade("in") }).delay(1000)
			}else{
				e.fade("out")
			}
		});
		indice++;
	}
});
window.addEvent("domready", function(){
	var s = new smartscroller();
});
