﻿/*!
* Scandia Business Logic Library
*
* Business logic library for extending Web applications
*
* Requires jQuery
*/

var DEFAULT_FUND_ID;

$(document).ready(function () {

    // fund tabs handler
    $("#fund-tabs li a").click(function () {
        var fundId = $(this).attr('rel');

        // hide all of the tables first...
        $('.historic-table, .perf-table').hide();

        // reset tabs...    
        $("#fund-tabs li a").removeClass("active");

        // select the tab
        selectTab(fundId);

        return false;
    });

    // load the default fund...
    selectTab(DEFAULT_FUND_ID, "noFade");
});

function selectTab(fundId) {
    // show the one we're looking for..
    if (arguments.length > 1) {
        $("#data-" + fundId + ", #historic-" + fundId).show();
    } else {
        $("#data-" + fundId + ", #historic-" + fundId).fadeIn('slow');
    }
    // hilight the selected tab...
    $("#tab-" + fundId).addClass("active");

    return false;
}
