//This array defines the absolute inception date for every fund to allow for calculations of elapsed time
var AbsoluteInception = new Array;
// Institutional Mutual Funds - Retail Class
    for (i=59; i<=70; i++) {// Funds 59-70 have an inception date of 3/31/2006
        AbsoluteInception[i] = 732781;
    }
// Retail Mutual Funds
    for (i=71; i<=76; i++) {// Funds 71-76 have an inception date of 9/2/1997
        AbsoluteInception[i] = 729649;
    }
    for (i=80; i<=84; i++) {// Funds 80-84 have an inception date of 4/3/2000
        AbsoluteInception[i] = 730594;
    }
    for (i=85; i<=90; i++) {// Funds 85-90 have an inception date of 10/1/2002
        AbsoluteInception[i] = 731504;
    }
// Retirement Accounts
    AbsoluteInception[1001] = 713182;// 8/1/1952
    AbsoluteInception[1002] = 727700;// 5/1/1992
    AbsoluteInception[1003] = 728427;// 4/29/1994
    AbsoluteInception[1004] = 728427;// 4/29/1994
    AbsoluteInception[1005] = 726907;// 3/1/1990
    AbsoluteInception[1006] = 726907;// 3/1/1990
    AbsoluteInception[1007] = 729525;// 5/1/1997
    AbsoluteInception[1008] = 726209;// 4/1/1988
    AbsoluteInception[1009] = 728948;// 10/2/1995
// After-Tax Annuities
    AbsoluteInception[1010] = 728613;// 11/1/1994
    AbsoluteInception[1011] = 730138;// 1/4/1999
    for (i=1012; i<=1015; i++) {// Funds 1012-1015 have an inception date of 4/3/2000
        AbsoluteInception[i] = 730594;
    }
    for (i=1016; i<=1018; i++) {// Funds 1016-1018 have an inception date of 10/28/2002
        AbsoluteInception[i] = 731531;
    }
    AbsoluteInception[1019] = 731797;// 7/21/2003
    AbsoluteInception[1020] = 731797;// 7/21/2003
    AbsoluteInception[1021] = 730138;// 1/4/1999
    for (i=1022; i<=1025; i++) {// Funds 1022-1025 have an inception date of 4/3/2000
        AbsoluteInception[i] = 730594;
    }
    for (i=1026; i<=1028; i++) {// Funds 1026-1028 have an inception date of 10/28/2002
        AbsoluteInception[i] = 731531;
    }
// Institutional Mutual Funds - Institutional Class
    for (i=1601; i<=1615; i++) {// Funds 1601-1615 have an inception date of 10/1/2002
        AbsoluteInception[i] = 731504;
    }
    AbsoluteInception[1634] = 731504;// 10/1/2002
    for (i=1824; i<=1829; i++) {// Funds 1824-1829 have an inception date of 3/31/2006
        AbsoluteInception[i] = 732781;
    }
    for (i=1810; i<=1816; i++) {// Funds 1810-1816 have an inception date of 6/23/2006
        AbsoluteInception[i] = 732865;
    }
    for (i=1830; i<=1836; i++) {// Funds 1830-1836 have an inception date of 7/1/1999
        AbsoluteInception[i] = 730316;
    }
// Institutional Mutual Funds - Retirement Class
    for (i=1616; i<=1633; i++) {// Funds 1616-1633 have an inception date of 10/1/2002
        AbsoluteInception[i] = 731504;
    }
    for (i=1635; i<=1643; i++) {// Funds 1635-1643 have an inception date of 3/31/2006
        AbsoluteInception[i] = 732781;
    }
// Lifecycle Mutual Funds
    for (i=1650; i<=1656; i++) {// Funds 1650-1656 have an inception date of 10/15/2004
        AbsoluteInception[i] = 732250;
    }


// These variables calculate the elapsed time between today and the inception date
var tidays = AbsoluteInception[fundId];
var tcdays = parseInt(365.25*cyear) + parseInt(cdd);
var agemarker = parseInt(tcdays-tidays);

//This function allows for the swapping of graph images
function changeGraph(timePeriod) {
    timePeriod = timePeriod;
    //$cmignore
    document["Chart"].src = "http://www3.tiaa-cref.org/charts/" + GraphCode + timePeriod + ".gif";
    //$/cmignore
    if ( ((agemarker <= 1095) && (timePeriod == 1095)) || (((agemarker > 1095) && (agemarker <= 1826)) && (timePeriod == 1825)) || (((agemarker > 1826) && (agemarker <= 3652)) && (timePeriod == 3650)) ) {
        timePeriod = "incep";
    }
    document["ChartTitle"].src = "/images/performance/" + NavOrUv + timePeriod + ".png";
}

//This variable dynamically writes the text links for the graph switcher based on age of fund
var graphChanger = "<a href=javascript:changeGraph(30);>30-day<\/a>";
graphChanger += " | <a href=javascript:changeGraph(90);>90-day<\/a>";
graphChanger += " | <a href=javascript:changeGraph(180);>180-day<\/a><br\/>";
graphChanger += "<a href=javascript:changeGraph(365);>1-Year<\/a>";
if (agemarker > 1095) {
    graphChanger += " | <a href=javascript:changeGraph(1095);>3-Year<\/a>";
    if (agemarker > 1826) {
        graphChanger += " | <a href=javascript:changeGraph(1825);>5-Year<\/a>";
        if (agemarker > 3652) {
            graphChanger += " | <a href=javascript:changeGraph(3650);>10-Year<\/a>";
        }
        else {
            graphChanger += " | <a href=javascript:changeGraph(3650);>Since Inception<\/a>";
        }
    }
    else {
        graphChanger += " | <a href=javascript:changeGraph(1825);>Since Inception<\/a>";
    }
}
else {
    graphChanger += " | <a href=javascript:changeGraph(1095);>Since Inception<\/a>";
}


