(function(){
  $(document).ready(function() {
    var interval, re_stack;
    interval = 5000;
    re_stack = function re_stack() {
      var bottom, new_bottom, top;
      top = $("ol.image_stack li.top_of_stack").removeClass("top_of_stack");
      bottom = $("ol.image_stack li.bottom_of_stack").removeClass("bottom_of_stack");
      new_bottom = bottom.next();
      if (new_bottom.length < 1) {
        new_bottom = bottom.siblings().first();
      }
      bottom.addClass("top_of_stack");
      new_bottom.addClass("bottom_of_stack");
      return setTimeout(re_stack, interval);
    };
    if ($("ol.image_stack").length > 0) {
      return setTimeout(re_stack, interval);
    }
  });
})();

