jQuery(document).ready(function($) {
  // External Links
  $("a[rel=external]").attr('target', '_blank');

  // Works page
  var moreInfo = $('div.work-info');
  //moreInfo.hide();

  var theWork = $('div.content-work-child div#main');
  var moreInfoTrigger = $('<a class="work-info-trigger" href="#">[-]</a>');
  if ( moreInfo.length > 0 ) theWork.prepend(moreInfoTrigger);
  moreInfoTrigger.click(function() {
    $(this).text($(this).text() == '[-]' ? '[+]' : '[-]');
    $(this).next(moreInfo).slideToggle("slow");
    return false;
  });

  var scrollable = $("div.scrollable");
  scrollable.scrollable({
    item: "div.scrollable div.item",
    size: 1
  })
    .mousewheel()
    .navigator("div.scrollable ul.nav")

  // The Boxes
  var box = $('div.box');
  var boxTitle = $('div.box .title');
  boxTitle.css('bottom', '-38px');
  box.hover(
    function(){
      $('h2.title', this).animate({
        bottom: 0,
      }, 300)
    },
    function(){
      $('h2.title', this).animate({
        bottom: '-38',
      }, 300)
    }
  );
  var smallThumb = $('div.scrollable ul.nav img');
  if ( $(smallThumb).length > 0 ) {
    $("div.scrollable ul.nav img[title]" ).tooltip({
      tip: '#tooltip',
      effect: 'slide',
      offset: [9, -59],
      position: 'top right'
      //relative: true
    })
    .dynamic({
      bottom: {
        direction: 'down',
        bounce: true
      }
    });
  }

  // News Accordion
  var newsTrigger = $('a.month');
  var newsList = $('ul.month_archive');
  newsList.hide();
  newsTrigger.click(function() {
    newsTrigger.removeClass('active'),
    $(this).addClass('active');
    newsList.hide('slow');
    $(this).next(newsList).slideToggle("slow");
    return false;
  });

  // Video
});
