/* Copyright 2003-2009 Emergent Music LLC  All rights reserved.
 * $Id$
 */

FLYFI.isCustomRadioPlayer = function() {
    return $('body').hasClass('customradio');
}; 

FLYFI.isWidgetCreationPage = function() {
    return $('body').hasClass('widget') || $('body').hasClass('mywidget');
};

FLYFI.onClick_vidToggle = function(event) {
    if (event) {
        event.preventDefault();
        event.stopPropagation();
    }
    $("#player_shell_shell").toggleClass("bigvideo");
    var isBig = $("#player_shell_shell").hasClass("bigvideo");
    $("li.vid_toggle span").attr("title", isBig? 'Make the Video Smaller':'Make the Video Bigger' );    
    
    
    FLYFI.preferences.setBoolean(FLYFI.BIG_VIDEO, isBig );
    if (!FLYFI.isSafari() && FLYFI.playingTrack.playing && FLYFI.playingTrack.haveVideoTrack() && FLYFI.playerControls == FLYFI.playingTrack.playerControls) {
        FLYFI.playerControls.newVideoPlayer();
        var which = FLYFI.playingTrack_data_play.push(FLYFI.playerControls) - 1;
        setTimeout('FLYFI.playingTrack_popQueue_play(' + which + ')', 500); // not the normal queue since we need more time to allow the thickbox to clear
    }
};

FLYFI.startPlayer = function() {
    var w = $(window);
    w.trigger(FLYFI.MSG_Start); // ready to roll
    if (FLYFI.preferences.getBoolean(FLYFI.BIG_VIDEO) && $('.controls_on_page').length === 0) {
        FLYFI.onClick_vidToggle();
    }
    w.trigger(FLYFI.MSG_Started); // ready to roll
};

$(document).ready(function() {
    $(".vid_toggle").click(FLYFI.onClick_vidToggle);

    FLYFI.start_currentUser();
    FLYFI.startPlayer();
});


