$(document).ready(function()
{
    if(FlashDetect.installed == true)
    {
        $("#home-text").animate({'margin-right': '+=1200', 'margin-top': '+=1200'}, 1000, 'linear', function() 
        {
            $('#tagline').fadeIn(500, function() 
            {
                $('#tagline div.toplabel').animate({'margin-right': '0'}, 750, function() 
                {
                    $('#tagline div span.text-top').fadeIn();
                });

                $('#tagline div.bottomlabel').animate({'margin-left': '0'}, 750, function() 
                {
                    $('#tagline div span.text-bottom').fadeIn();
                });
            });
        });
    }
    else
    {
        $("#home-text").hide();
    }

    $(window).resize(function() 
    {
        if(FlashDetect.installed == true)
        {   
            videoHeight();
        }

        adjust_footer_promobox();
    });

    if(FlashDetect.installed == true)
    {   
        videoHeight();
    }

    adjust_footer_promobox();
});

function adjust_footer_promobox()
{
    var window_height = $(window).width();

    $(".box_detail").each(function()
    {
        window_height -= $(this).outerWidth();
    });

    var margin_left = (window_height / 2);

    if (margin_left >= 63)
    {
        $("#second_boxes").css({"margin-left" : margin_left + "px"});
    }
}

function videoStarted()
{
    $('#image_container').fadeIn(1000);
}

function videoHeight()
{
    var footerHeight  = $('#footer').outerHeight();
    var headerHeight  = $('#header').outerHeight();
    var windowHeight  = $(window).height();
    var contentHeight = windowHeight - (footerHeight + headerHeight);

    $('#videobackground-container').css('height', contentHeight);
}
