
if ( typeof(swf_path) == 'undefined' )
  var swf_path = '/javascripts';

$(document).ready(function() {

  if(!FlashDetect.installed) {
    return;
  }
  
  // HACK: to align the client name over the images on the right
  var ph3 = $('#portfolio .image h3')
  ph3.width(ph3.width());
  
  
  $('#home-sifr .bold').css({'font-weight' : 'bold'});
  
  
  $('h2#slogan .red').sifr({
    font: 'din_regular',
    path: swf_path,
    color: '#ce3e4b'
  });
  
  $('h2#slogan .white').sifr({
    font: 'din_regular',
    path: swf_path,
    color: '#fff'
  });
  
  $('#main-nav li a').sifr({
    font: 'din_bold',
    path: swf_path,
    hover: '#c44043',
    textTransform: 'uppercase'
  });
  
  $('#home-sifr h2').sifr({
    font: 'din_regular',
    path: swf_path
  });
  
  $('#home-sifr h3').sifr({
    font: 'din_regular',
    path: swf_path
  });
  
  
  
  $('.site-content h4 ').sifr({
    font: 'din_bold',
    path: swf_path
  });
  
  $('h3.sifr-single').sifr({ font: 'din_bold', path: swf_path });
  $('h3.sifr strong').sifr({ font: 'din_bold', path: swf_path });
  $('h3.sifr span').sifr({ font: 'din_bold', path: swf_path });
  
  $( '.substantial-person' ).click( function(){
    $( '#the-bubble' ).show();
    return false;
  });
  $( 'body' ).click( function(){
    $( '#the-bubble' ).hide();
    $('#footer-bubble').remove();
  });
  
  if ( typeof(IS_BLOG) != "undefined" ) {
    var cache = ['bubble-c.png', 'bubble-t.png', 'bubble-b.png', 'bubble-b-r.png'];
    var image_path = 'css/images/';
    for ( var i=0; i < cache.length; i++ ) {
      var img = new Image();
      img.src = image_path + cache[ i ];
    }
  }
  
  $('.footer-tab').click( function(){
    var cnt = $( this ).parent().find('p').html();
    var li = $( this ).parent();
    
    var right = $( this ).hasClass('right-bubble') ? ' bubble-r' : '';
    var bubble = '<div class="bubble-container' + right +'" id="footer-bubble">';
    bubble += '<div class="bubble"><div class="bubble-t">&nbsp;</div><div class="bubble-bg">';
    bubble += '<p>' + cnt + '</p>';
    bubble += '</div><div class="bubble-b">&nbsp;</div></div></div>';
    
    $('#footer-bubble').remove();
    li.append( bubble );
    var new_top = -1 * li.find( '.bubble p' ).height() - 95;
    li.find( '.bubble' ).css({'top' : new_top });
    return false;
  });
  
});
