$(document).ready(function() {
  $('a[rel=external]').click(function() {
    var newWindow = window.open($(this).attr('href'), '_blank');
    if(newWindow) { if(newWindow.focus) { newWindow.focus(); return false; } }
    newWindow = null;
  });

  $('.work_example').hide();
  $('.work_example:first').show();
  $('#work_navigation li:first').addClass('current');
  $('#work_navigation li').click(function() {
    var target = $($(this).find('h2 a').attr('href'));
    if(!target.is(':visible')) {
      $('.work_example').hide();
      $('#work_navigation li').removeClass('current');
      $(this).addClass('current');
      target.fadeIn(150);
    }
    return false;
  }).hover(function() {
    $(this).addClass('hover');
  }, function() {
    $(this).removeClass('hover');
  });
});
