var ss = {
 init: function() {	
  new Insertion.Top('content','<div id="slideshow"></div>');
  new Insertion.Bottom('slideshow','<div class="slide"><img alt="" height="372" src="/images/slideshow/brothers2.jpg" width="509" /></div>');
  new Insertion.Bottom('slideshow','<div class="slide"><img alt="" height="372" src="/images/slideshow/pitcher2.jpg" width="509" /></div>');
  new Insertion.Bottom('slideshow','<div class="slide"><img alt="" height="372" src="/images/slideshow/building2.jpg" width="509" /></div>');
  new ss.start('slideshow', 3000);
 },
 start: function(slideshow_id, timeout) {
  this.slides = [];
  var nl = $(slideshow_id).getElementsByTagName('div');
  for (var i = 0; i < nl.length; i++) {
   if (Element.hasClassName(nl[i], 'slide')) {
    this.slides.push(nl[i]);
   }
  }
  this.timeout = timeout;
  this.current = 0;
  for (var i = 0; i < this.slides.length; i++) {
   this.slides[i].style.zIndex = this.slides.length - i;
  }
  Element.show(slideshow_id);
  setTimeout((function(){this.next();}).bind(this), this.timeout + 850);
 } 
}
ss.start.prototype = {
  next: function() {
   for (var i = 0; i < this.slides.length - 1; i++) {
    var slide = this.slides[(this.current + i) % this.slides.length];
    slide.style.zIndex = this.slides.length - i;
   }
   Effect.Fade(this.slides[this.current], {
    afterFinish: function(effect) {
     effect.element.style.zIndex = 0;
     Element.show(effect.element);
     Element.setOpacity(effect.element, 1);
    }
   });
   this.current = (this.current + 1) % this.slides.length;
   setTimeout((function(){this.next();}).bind(this), this.timeout + 850);
  }
}
Event.observe(window, 'load', ss.init, false);