jQuery.ajaxSetup({
  'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
});

$(document).ready(function(){ 
  
  
  $('#projects a.view').click(function(){
    $.get($(this).attr('rel'), null, function(data){
      $("#pictures").html(data);
      $("#pictures #thumbs a").overlay({ 
            target: '#gallery', 
            expose: '#000'
          }).gallery({
          speed: 800,
          template: '<strong>${title}</strong>' 
      }); 
      $("#thumbs a:first").trigger('click');
    }, 'html')
  });
  
  $.easing.bouncy = function (x, t, b, c, d) { 
      var s = 1.70158; 
      if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 
      return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 
  } 
  
  // create custom tooltip effect for jQuery Tooltip 
  $.tools.tooltip.addEffect("bouncy", 

      // opening animation 
      function(done) { 
          this.getTip().animate({top: '+=15'}, 500, 'bouncy', done).show(); 
      }, 

      // closing animation 
      function(done) { 
          this.getTip().animate({top: '-=15'}, 500, 'bouncy', function()  { 
              $(this).hide(); 
              done.call(); 
          }); 
      } 
  );
  
  $(".project img[title]").tooltip({tip: '.tooltip', effect: 'bouncy'});

  $("#projects img.old").hover(
    function() {$(this).css({"border":"1px solid #6bc6ff"});},
    function() {$(this).css({"border":"1px solid #000"});}
  );
});