$(document).ready(function() {

    if ($('#homeLinks li a').length > 0) {
        $('#homeLinks').pngFix();
        initHomeLinks();
    }
    if ($('#connectNav li a').length > 0) {
        
        $('#connectNav').pngFix();
        //initConnectLinks();
    }
    if ($('div.blogLinks').length > 0) $('div.blogLinks li').pngFix();

    if ($('.event').length > 0) {
        $('.event .details li').each(function() {

            $(this).css('height', $(this).parent().height() - 13);

        });
    }

    if ($('.backToTop').length > 0) {
        $('.backToTop').click(function(e) {
            $("html, body").animate({ scrollTop: 0 }, { duration: 650, easing: 'easeInOutCubic', queue: false });
            return false;
        });
    }

});

function initHomeLinks() {
    
    $('#homeLinks li a').each(function() {
        
        $('span', this).append('<br /><em>' + $(this).attr('title') + '</em>');
        $(this).removeAttr('title');
        
    });
    
    $('#homeLinks li a').hover(function(e) {
        $(this).animate({ top: -36 }, { duration: 200, easing: 'easeOutExpo', queue: false });
    }, function(e) {
        $(this).animate({ top: 0 }, { duration: 200, easing: 'easeOutQuint', queue: false });
    });

}
function initConnectLinks() {

    $('#connectNav a').each(function() {

        $('span', this).append('<br /><em>' + $(this).attr('title') + '</em>');
        $(this).removeAttr('title');

    });

    $('#connectNav a').hover(function(e) {
        $(this).animate({ top: -36 }, { duration: 200, easing: 'easeOutExpo', queue: false });
    }, function(e) {
        $(this).animate({ top: 0 }, { duration: 200, easing: 'easeOutQuint', queue: false });
    });

}
