$(document).ready(function () {
    // Initialize fancybox plugin
    $(".fancybox").fancybox();

    // Alternating table rows
    $('tbody tr').removeClass("alt-row"); // Remove all .alt-row classes
    $('tbody tr:even').addClass("alt-row"); // Add .alt-row to even table rows

    // Content tabs:
    $('.content-box-header ul li:first-child a').addClass('current'); // Add .current to the first class
    $('.content-box .tab-content').hide(); // Hide all .tab-content divs
    $('.content-box .tab-content:first-child').show(); // Show default tabs

    $('.content-box-header ul li a').click(function () {
        $(this).parent().siblings().find("a").removeClass('current'); // Remove .current from all tabs
        $(this).addClass('current'); // Set tab to current
        var tabcontent = $(this).attr('href'); // Get link to requested tab
        $(tabcontent).siblings().hide(); // Hide all other .tab-content divs
        $(tabcontent).show(); // Show content div
        return false;
    });

    // Close Status line notifications: fadeout after 8 seconds
    if ($('#status-line').is(':visible')) {
        setTimeout(function () {
            $('#status-line').fadeOut('slow');
        }, 8000);
    }

    // Close Error line notifications: fadeout after 8 seconds
    if ($('#error-line').is(':visible')) {
        setTimeout(function () {
            $('#error-line').fadeOut('slow');
        }, 8000);
    }

    // Setup tooltips
    $('[title]').tooltip({
        effect: 'slide', offset: [-14, 0], position: 'top center', layout: '<div><em/></div>',
        onBeforeShow: function () {
            this.getTip().each(function () {
                if ($.browser.msie) {
                    PIE.attach(this);
                }
            });
        },
        onHide: function () {
            this.getTip().each(function () {
                if ($.browser.msie) {
                    PIE.detach(this);
                }
            });
        }
    }).dynamic({
        bottom: { direction: 'down', bounce: true }
    });

});



