Slideshow = Class.create({
  initialize: function(handle, options) {
	this.handle = handle;
	this.options = options || { };
	this.options.min = 2500;
	this.options.max = 6000;
	this.imgs = this.handle.getElementsByTagName('li');
	this.cur_frame = 0;
	for(i=0; i<this.imgs.length; i++) {
		if(i!=0)
		  this.imgs[i].style.display = 'none';
	}
	this.last_img = this.imgs.length - 1;
	this.handle.ss=this;
	setTimeout(this.handle.ss.swapImages.bind(this), this.getTimeout());
  },

  swapImages: function() {
	Effect.Fade(this.imgs[this.cur_frame]);
	if(this.cur_frame==this.last_img)
		this.cur_frame = 0
	else
		this.cur_frame++;
	newImg = this.imgs[this.cur_frame];
	Effect.Appear(newImg);
	setTimeout(this.swapImages.bind(this), this.getTimeout());
  },

  getTimeout: function() {
	return Math.floor(Math.random() * (this.options.max - this.options.min + 1)) + this.options.min;
  }
});
