(function() {
  jQuery(document).ready(function($) {
    var gallery, onMouseOutOpacity, pageload;
    pageload = function(hash) {
      if (hash) {
        return $.galleriffic.gotoImage(hash);
      } else {
        return gallery.gotoIndex(0);
      }
    };
    onMouseOutOpacity = 0.3;
    $("#thumbs ul.thumbs li").opacityrollover({
      mouseOutOpacity: onMouseOutOpacity,
      mouseOverOpacity: 1.0,
      fadeSpeed: "fast",
      exemptionSelector: ".selected"
    });
    gallery = $("#thumbs").galleriffic({
      delay: 2500,
      preloadAhead: 10,
      enableTopPager: true,
      enableBottomPager: true,
      imageContainerSel: "#slideshow",
      captionContainerSel: "#caption",
      loadingContainerSel: "#loading",
      enableHistory: true,
      autoStart: false,
      syncTransitions: true,
      defaultTransitionDuration: 900,
      onSlideChange: function(prevIndex, nextIndex) {
        return this.find("ul.thumbs").children().eq(prevIndex).fadeTo("fast", onMouseOutOpacity).end().eq(nextIndex).fadeTo("fast", 1.0);
      },
      onPageTransitionOut: function(callback) {
        return this.fadeTo("fast", 0.0, callback);
      },
      onPageTransitionIn: function() {
        return this.fadeTo("fast", 1.0);
      }
    });
    $.historyInit(pageload, "advanced.html");
    return $("a[rel='history']").live("click", function(e) {
      var hash;
      if (e.button !== 0) {
        return true;
      }
      hash = this.href;
      hash = hash.replace(/^.*#/, "");
      $.historyLoad(hash);
      return false;
    });
  });
  jQuery(document).ready(function($) {
    return $("*[title]").tipsy();
  });
}).call(this);

