var hiddenSchedule;
var schduleShowing = false;
var newwindow;

window.onload = function()
{
    hiddenSchedule = $(".hiddenSchedule");
}

function toggleShedule()
{
    if (!schduleShowing)
    {
        hiddenSchedule.slideDown("slow");
        schduleShowing = true;
    } else {
        hiddenSchedule.slideUp("slow");    
        schduleShowing = false;
    }
}

function popUpPlayer(pid, sf, type, play)
{    
    var h;
    if (type == 'video') h = 398;
    if (type == 'audio') h = 184;
    
    // newwindow = window.open('/player/?pid='+pid+'&sf='+sf+'&playing='+play, 'popoutPlayer','status=no,toolbar=no,location=no,resizable=no,scrollbars=no,menubar=no,width=624,height='+h);
    newwindow = window.open('/player/?pid='+pid+'&sf='+sf+'&type='+type, 'popoutPlayer','status=no,toolbar=no,location=no,resizable=no,scrollbars=no,menubar=no,width=624,height='+h);
    
    if (window.focus) {newwindow.focus()}
    return false;
    
}

function changePlayerSize(h)
{
    // alert(h);
    // $('#player').animate({height: h}, 1000);
    // $('.swfPlayer').animate({height: h}, 1000);
    
    $('#player').height(h);
    $('.swfPlayer').height(h);
}

function showVideoPlayer()
{
    if (flashvars.popup) t_resizeWindow(624,398);
    swfobject.embedSWF("/wp-content/themes/elfm/swf/videoplayer.swf", "player", "620", "394", "9.0.0", "/wp-content/themes/elfm/swf/expressInstall.swf", flashvars, params, attributes);
}

function showAudioPlayer()
{
    if (flashvars.popup) t_resizeWindow(624,184);
    swfobject.embedSWF("/wp-content/themes/elfm/swf/audioplayer.swf", "player", "620", "180", "9.0.0", "/wp-content/themes/elfm/swf/expressInstall.swf", flashvars, params, attributes);
}

function t_resizeWindow(w,h)
{
    try
    {
        window.innerWidth = w;
        window.innerHeight = h;
    } catch(e) {
        alert('Internet Explorer my not resize properly. Please drag the window size yourself. Thanks.');
        window.resizeTo(w,h)
    }   
}
