﻿

//Method to handle which tab is showing
function ShowTab(sSectionName)
{
    
    //Hide all the tabs
    document.getElementById("tdhealthGoals").style.display = "none";
    document.getElementById("tdcareerGoals").style.display = "none";
    document.getElementById("tdpersonalGoals").style.display = "none";
    var healthTab = document.getElementById("healthTab");
    var careerTab = document.getElementById("careerTab");
    var selfTab = document.getElementById("personalTab");
    SetTabToDefault(healthTab);
    SetTabToDefault(careerTab);
    SetTabToDefault(selfTab);
    //Show the one
    var sTdGoalName = "td" + sSectionName + "Goals";
    var sTabName = sSectionName + "Tab";
    var oTDGoal = document.getElementById(sTdGoalName);
    var oTab = document.getElementById(sTabName);
    oTab = document.getElementById(sTabName);
    if(oTab != null)
    {
        oTDGoal.style.display = "block";
        tabSelectInput.value = sSectionName;  //
        if(oTab != null)
        {
            oTab.src = oTab.src.replace("_off.", "_active.");
            oTab.src = oTab.src.replace("_on.", "_active.");
           }
           
        //set the magic srever side control to contain the active tab   
        //document.getElementById("ctl00_hldrMain_ctl00_btnContinue").activeTab = sSectionName; 
    }
    
    //Call recalculate on all the sliders
    for(var nCounter = 0; nCounter < arrSliders.length; nCounter++)
        arrSliders[nCounter].recalculate();
        
    return;
}

function SetTabToDefault(oImageTab)
{
    oImageTab.src = oImageTab.src.replace("_on.", "_off.");
    oImageTab.src = oImageTab.src.replace("_active.", "_off.");
    return;
}

function ShowStatusTab(sSectionName)
{
    //Hide all the tabs
    document.getElementById("td10YearGoal").style.display = "none";
    document.getElementById("td5YearGoal").style.display = "none";
    document.getElementById("td1YearGoal").style.display = "none";
    
    var tabTenyear = document.getElementById("10yearTab");
    var tabFiveyear = document.getElementById("5yearTab");
    var tabOneyear = document.getElementById("1yearTab");
    SetTabToDefault(tabTenyear);
    SetTabToDefault(tabFiveyear);
    SetTabToDefault(tabOneyear);
    
    //Show the one
    var sTdGoalName = "td" + sSectionName + "YearGoal";
    var sTabName = sSectionName + "yearTab";
    var oTDGoal = $(sTdGoalName);
    var oTab = $(sTabName);
    if(oTDGoal != null)
    {
    	oTDGoal.style.display = "block";
    	tabSelectInput.value = sSectionName;  //
        if(oTab != null)
        {
            oTab.src = oTab.src.replace("_off.", "_active.");
            oTab.src = oTab.src.replace("_on.", "_active.");
        }
    }
        
    return;
}

