  $(function() {
    var slideshow;
    slideshow = {
      slider: $('#splash').children('.slideshow-wrapper'),
      slides: $('#splash').children('.slideshow-wrapper').children('figure'),
      indc: $('#splash').children('.slideshow-indicators').children('li'),
      caption: $('#slideshow-caption'),
      width: 940,
      speed: 1000,
      start: 1,
      interval: 10000,
      initialize: function() {
        var content, first, last;
        var _this = this;
        first = this.slides.first();
        last = this.slides.last();
        content = this.slides.eq(this.start - 1).children('aside').html();
        this.indc.each(function(i, e) {
          return $(e).bind('click', function() {
            _this.stop();
            return _this.slideTo(i);
          });
        });
        if ($.browser.msie) this.slides.addClass('figure');
        $('.curtain').css({
          opacity: 0.5
        });
        first.clone(true).appendTo(this.slider).children('aside').remove('aside');
        last.clone(true).prependTo(this.slider).children('aside').remove('aside');
        this.indc.removeClass('current').eq(this.start - 1).addClass('current');
        this.slider.css({
          width: (this.slider.children().length) * this.width,
          marginLeft: -(this.start * this.width)
        });
        if (content) this.caption.children('div').html(content).fadeIn(this.speed);
        this.currentSlide = this.start;
        return this.play();
      },
      slideTo: function(index) {
        var slide;
        var _this = this;
        slide = (index % this.slides.length) + 1;
        this.caption.children('div').fadeOut();
        this.indc.removeClass('current').eq(slide - 1).addClass('current');
        this.slider.animate({
          marginLeft: -(slide * this.width)
        }, {
          duration: this.speed,
          complete: function() {
            var content;
            content = _this.slides.eq(slide - 1).children('aside').html();
            if (content) {
              return _this.caption.fadeIn(_this.speed).children('div').html(content).fadeIn(_this.speed);
            } else {
              return _this.caption.fadeOut(_this.speed);
            }
          }
        });
        return this.currentSlide = slide;
      },
      advance: function() {
        return this.slideTo(this.currentSlide - 1 + 1);
      },
      play: function() {
        var _this = this;
        if (this.timer != null) return;
        return this.timer = setInterval(function() {
          return _this.advance();
        }, this.interval);
      },
      stop: function() {
        if (this.timer != null) {
          clearInterval(this.timer);
          return this.timer = null;
        }
      }
    };
    slideshow.initialize();
    return window.slideshow = slideshow;
  });

