var Slideshow = Class.create({
	initialize: function(el) {
		this.delay = 5;
		this.paused = 0;
		this.arrSlideElmt = $$('#'+el + ' li.photo');
		this.totalElmt = totalElmt = this.arrSlideElmt.length;
		this.curElmtNum = Math.floor(Math.random() * 4); //randomize first element
	},
	start: function() {
		//show first element without effect
		$(this.arrSlideElmt[this.curElmtNum]).setStyle({
			display: 'block'
		});
		this.executor = new PeriodicalExecuter(function() {
			this.next(); //start slidehow
		}.bind(this), this.delay);
	},

	next: function(){
		if (!this.paused) {
			this.update();
		}
	},
	update: function() {
		new Effect.Fade($(this.arrSlideElmt[this.curElmtNum]));
		this.checkSlide();
		new Effect.Appear($(this.arrSlideElmt[this.curElmtNum]));
	},
	checkSlide: function() {
		if (this.curElmtNum == this.totalElmt-1) {
			this.curElmtNum = 0;
		}
		else {
			this.curElmtNum ++;
		}
	}
});
