$(document).ready(function() {
    // 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"); $(this).css("float", "left"); });
    $(".ui-tabs .ui-tabs-panel img[align='right']").each(function() { $(this).css("margin-left", "20px"); $(this).css("float", "right"); });

    // Make sure tab area is at least as tall as the left nav
    var minHeight = $("#LeftNavContainer").height();
    $("#tabs").css("min-height", minHeight + "px");
});

function selectTab(idx) {
    $("#tabs").tabs("select", idx);
}