
function displayPress()
{
    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');
                initAllPress();
            });
        }
        else
        {
            $('#content').animate({'margin-left':$(window).width()}, 600, function()
            {
                initAllPress();
            });
        }
    }
    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');
                    initAllPress();
                });
            });
        }
        else
        {
            $('#content').animate({'margin-left':$(window).width(), 'opacity':'0'}, 600, function()
            {
                initAllPress();
            });
        }
    }
}

function initAllPress()
{    
    pageType = 3;
    $('#content-fix').html('');
    $('#content-scroll-content').html('');
    $('#content-fix').css('position', 'absolute');
    $('#content-fix').css('margin-left', 400);
    $('#content-fix').width(300);
    $('#content-fix').height(400);
    $('#content-scroll').width(370);
    $('#content-scroll').css('position', 'absolute');
    $('#content-scroll').css('margin-left', 10);
    $('#content-scroll-content').width(360);

    $('#content-loader').css('display', 'block');

    $.post('includes/php/press.php', {action:'load'}, function(data)
    {
        $('#content-loader').css('display', 'none');
        $('#content-fix').css('display', 'block');
        $('#content-scroll').css('display', 'block');
        $('#content-scroll-content').html(data);

        RPContent();

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

function initPress(id)
{
    clearClick = false;
    gallery.reset();

    if (id != 0)
    {
        $('.press-link').removeClass('press-link-selected');
        $('#press-link-'+id).addClass('press-link-selected');
    }
    else $.post('includes/php/press.php', {action:'get-id'}, function(data)
    {
        $('#press-link-'+data).addClass('press-link-selected');
    });

    $.post('includes/php/press.php', {action:'get-gallery', id:id}, function(data)
    {
        $.post('libraries/com/dop/php/ThumbnailGallery.php', {galleryID:data.split(';;')[0]}, function(data)
        {
            gallery.init("50", "#content-fix", data);
            clearClick = true;
        });

        if (data.split(';;')[1] == '') $('#press-pdf').html('');
        else $('#press-pdf').html('<a href="uploads/press/pdfs/'+data.split(';;')[1]+'" target="_blank">'+PRESS_CLICK_PDF+'</a>');
    });
}
