
function displayEvents()
{
    clearClick = false;
    if (isIE)
    {
        if ($('#content').css('display') == 'none')
        {
            $('#home-text').stop(true, true).animate({'opacity':'1'}, 600, function(){$('#home-text').css('display', 'none');});
            $('#news').stop(true, true).animate({'margin-top':$(window).height()}, 600, function()
            {
                $('#news').css('display', 'none');
                $('#content').css('display', 'block');
                initEvents();
            });
        }
        else
        {
            $('#content').animate({'margin-left':$(window).width()}, 600, function()
            {
                initEvents();
            });
        }
    }
    else
    {
        if ($('#content').css('display') == 'none')
        {
            $('#content').stop(true, true).animate({'opacity':'0'}, 0,  function()
            {
                $('#home-text').stop(true, true).animate({'opacity':'1'}, 600, function(){$('#home-text').css('display', 'none');});
                $('#news').stop(true, true).animate({'margin-top':$(window).height()}, 600, function()
                {
                    $('#news').css('display', 'none');
                    $('#content').css('display', 'block');
                    initEvents();
                });
            });
        }
        else
        {
            $('#content').animate({'margin-left':$(window).width(), 'opacity':'0'}, 600, function()
            {
                initEvents();
            });
        }
    }
}

function initEvents()
{    
    if (!isIPad) $("#controller-player").jPlayer("pause");
    else lastPageEvents = true;
    
    var HTML = '<div id="events-video-container"></div><div id="events-thumbnails-container"></div>';
    initPageType1();
    $('#content-scroll-content').html('');

    $('#content-loader').css('display', 'block');
    $.post('libraries/com/dop/php/ThumbnailScroller.php', {}, function(data)
    {
        $('#content-loader').css('display', 'none');
        $('#content-fix').css('display', 'block');
        $('#content-scroll').css('display', 'block');
        $('#content-fix').html(HTML);
        $('#content-scroll-content').html('');
        
        thumbnailScroller.reset();
        thumbnailScroller.init("1", "#events-thumbnails-container", data);

        RPContent();

        if (isIE) initEvent(0);
        else $('#content').stop(true, true).animate({'opacity':'1'}, 300, function(){initEvent(0)});
    });
}

function initEvent(id)
{
    clearClick = false;
    $('#events-video-container').html('');
    $('#content-scroll-content').html('');
    $('#events-video-container').addClass('video-loader');

    RPContent();
    
    $.post('includes/php/events.php', {action:'load', id:id}, function(data)
    {
        $('#events-video-container').html(data.split(';;;;;')[0]);
        $('#content-scroll-content').html(data.split(';;;;;')[1]);
        $('iframe', '#events-video-container').width(700);
        $('iframe', '#events-video-container').height(399);
        RPContent();
        
        if (isIE) clearClick = true;
        else $('#content').stop(true, true).animate({'opacity':'1'}, 300, function(){clearClick = true;});
    });
}
