$(document).ready(function() {
    // Add resource center tab
    // alert($("#resourceCenterTabContainer li").length);
    if ($("#resource_center").length > 0) {
        $("<li><a href='#resource_center'><span>Resource Center</span></a></li>").appendTo("#tabs ul:first");
        $("#resource_center").appendTo("#tabs");
    }

    // Set up tabs
    // Using fx causes the page to jump to the top on tab click
    $("#tabs").tabs(); // { fx: { opacity: "toggle", duration: "fast"} });

    // Space images inside tabs based on their alignment (e.g. give left-aligned images a right-margin and vice versa)
    $(".ui-tabs .ui-tabs-panel img[align='left']").each(function() { $(this).css("margin-right", "20px"); });
    $(".ui-tabs .ui-tabs-panel img[align='right']").each(function() { $(this).css("margin-left", "20px"); });

$("#maincontentcontainer").css("padding-bottom", "0");
});

function selectTab(idx) {
    $("#tabs").tabs("select", idx);
}