$(document).ready(function(){

  // Uses Superfish JQuery library for adding effects to Suckerfish (semantic)
  // type drop-down menus.
  $("#navigation ul").superfish({
    delay: 500,
    animation: 	{height: 'show'},
    speed: 'fast',
    autoArrows: false
  });

  $('#slideshow a').facebox({
    closeImage: '/images/facebox/closelabel.gif',
    loadingImage: '/images/facebox/loading.gif'
  });

  $('.web_pics a').facebox({
    closeImage: '/images/facebox/closelabel.gif',
    loadingImage: '/images/facebox/loading.gif'
  });

  // when you click on a movie link, play the movie
  $("#movies a[rel='movie']").each( function() {
    $(this).click( function(e) {
      var uri = $(this).attr('href');

      // replace the player div with the movie
      $('#video-player').load('/play_video', { 'movie' : uri });

      e.preventDefault();
    });
  });

  // when you click on an audio link, play the track
  $("#tracks a[rel='track']").each( function() {
    $(this).click( function(e) {
      var uri = $(this).attr('href');

      // replace the player div with the movie
      $('#audio-player').load('/play_audio', { 'track' : uri });

      e.preventDefault();
    });
  });

  $('#slideshow').cycle({
    fx: 'fade',
    next: '#next',
    prev: '#previous',
    sync: true,
    fit: 0,
    pause: 0,
    speed: 500,
    timeout: 0,
    pager: '#pager'
  });

  $('#blog-slideshow').cycle({
    fx: 'fade',
    speed: 500
  });

  $('#web_highlights_wrapper').serialScroll({
    items: '.web_highlight',
    cycle: true,
    interval: 7000
  });

  // Auto-start the web scroll on DOM ready.
  $("#web_highlights_wrapper").trigger("next");

  $(".corner").addClass(document.location.pathname.split("/")[1]);

});
