$(document).ready(function () {
    
    // Cufon replacements
    Cufon.replace('#content h2, #sidebar h3, #content .post h3, #navigation li, ul.post-meta, p.tags, #content h3, #main .home #navigation li, div#director-text li.director-title, .campaign-monitor label, .gform_wrapper label, .home p ', {hover: true});
    
    $('ul#sitemap').quickTree();
    
	
	// make links with rel=external open in new window/tab
	$(function() {
        $('a[rel*=external]').click( function() {
            window.open(this.href);
            return false;
        });
    });
    
    //$("a[rel=set_1]").fancybox({    
    $("a.thickbox").fancybox({
        'transitionIn' : 'none',
    	'transitionOut' : 'none',
    	'titlePosition' : 'over',
    	'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
    	    return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
    	}
    });
    
    
    
    $('a.director-thumb').click(function() {
      var clipText = $(this).children('span.clip-text').html();
      var imageUrl = $(this).children('span.clip-bg').html();
      $('#director-text').html(clipText);
      Cufon.replace('div#director-text li.director-title');
      $('.video-container').css('background-image', 'url(' + imageUrl + ')');
    });
    
	
});

var player = null;
function playerReady(thePlayer) {
	player = window.document[thePlayer.id];
}


