$(document).ready(function(){
    
    $('ul.tabs a').click(function(){
        $('.replaced').html($(this.hash).html());
        
        $('ul.tabs a')
            .removeClass('current');
            
        $(this).addClass('current');
        $('a.popup').facebox();
        $('a.video_link').click(function(){
            $('.video').flash({
                src: '/swf/video-player2.swf',
                background:'#ffffff',
                height: 325,
                width: 433
            });
            return false;
        });
        
        
        $('.portfolio_box').each(function(){
            var div = $(this).find('p').parent();
            var totalHeight = $(this).height();
            var dHeight = div.height();
            var pad = Math.floor((totalHeight - dHeight) / 2)
            div.css('padding-top', pad+'px');
        });
                
        return false;
    });
    
    $('#flash').flash({
        src: '/swf/intro.swf',
        background: "#fff",
        width: 500,
        height: 343
    });
    
    $('.audio').each(function(){
        var a = $('a', this);
        $(this).html("");
       $(this).flash({
           src: '/swf/player.swf',
           background: '#ffffff',
           height: 50,
           width: 290,
           flashvars: {
               soundFile: a.attr('href'),
               artists: a.attr('rel'),
               titles: a.html()
           }
       });
    });
        
    $(document).bind('reveal.facebox', function() {
        $('#facebox a.next').click(function(){
            $("#facebox .content img").attr({src: this.href});
            return false;
        });
        $('a.close').click($.facebox.close)
    });
        
});
