/*
 * Javascript Class for handling the category tree
 * @author: Daniel Auener <daniel@internetavdelningen.se>
 */
var Bildspel = Class.create({ 


	// Initialize one Category Tree
	initialize: function(listId,start,update) { 		
		
		this.list = $$("#"+listId+" li");
		
		this.iterator = 0;
		
		// position settings for picturefader
		if (this.list.size() > 1) {
			new PeriodicalExecuter(function(pe) {
				new PeriodicalExecuter(this.change.bind(this), update);
				this.change();
				pe.stop();
			}.bind(this), start);
		}
	},
	
	change: function() {
		//alert(this.iterator);
 		new Effect.Fade(this.list[this.iterator]);
		this.iterator = (this.iterator+1 >= this.list.size()) ? 0 : this.iterator+1;
		new Effect.Appear(this.list[this.iterator]);
	}
	
});