var theFullscreenFeature;

$().ready(function(){
    theFullscreenFeature = new Ctrl_Dialog_Iframe({ 
        modal: true, 
        width: 960, 
        height: 635, 
        resizable: false, 
        draggable: false,
        open: function(event, ui) { $('body').css('overflow', 'hidden'); },
        close: function(event, ui) { $('body').css('overflow', 'auto'); }
    });
    theFullscreenFeature.window.attr('id', 'fullscreen-feature-player');
    
    $('a.launch-fullscreen').click(function(){
        theFullscreenFeature.setSrc(this.href + '?format=fullscreen').open();
        
        var id = this.href.match(/features\/post\/(\d+)/);
        id = id[1];
        
        $.get(Ctrl.Config.baseUrl + '/feature/audio/id/' + id, function(resp) {
            theFullscreenFeature.elem.prepend(resp);
        });
    
        return false;
    });
    
    $('#content .rowB .ctrl-paginator').colorPaginator();
    
    $(window).bind('resize', function(){
        var $w = $(this);
        var $fp = $('#fullscreen-feature-player');
        
        $fp.css({
            left:($w.width() - $fp.width()) /2,
            top: ($w.height() - $fp.height()) /2
        });
    });
});


