// JScript File

// Data Format -- divID|depth|text|url|description
newsletterNavItems = new Array(
    "NewsLetterNav|0|Investing Newsletters|javascript:OpenClose('NewsLetterNav', 'NewsLetterNavList')|",
    "mfiNav|1|FundInvestor|//mfi.morningstar.com/purchase.aspx|",
    "msiNav|1|StockInvestor|//msi.morningstar.com/purchase.aspx|",
    "mdiNav|1|DividendInvestor|//mdi.morningstar.com/purchase.aspx|",
    "etfNav|1|ETFInvestor|//etf.morningstar.com/purchase.aspx|",
    "ffrNav|1|Fund Family Reports|//ffr.morningstar.com/purchase.aspx| ",
    "moiNav|1|OptionInvestor|//option.morningstar.com/Newsletter/purchase.aspx|",
    "oppNav|1|Opportunistic Investor|//opp.morningstar.com/purchase.aspx|",
    //"hcoNav|1|HealthcareObserver|//healthcare.morningstar.com/purchase.aspx|",
    "allNNav|1|All Newsletters|//www.morningstar.com/products/Store_NewsLetters.html|" 
);

booksNavItems = new Array(
    "BookNav|0|Books| javascript:OpenClose('BookNav', 'BookNavList')|",
    "tmsNav|1|30-Minute Money Solutions|//finance.morningstar.com/ThirtyMinSolution.aspx|",
    "gmfNav|1|Guide to Mutual Funds|//www.morningstar.com/products/Store_GuidetoMF.html|",
    "dbNav|1|Ultimate Dividend Book|//www.morningstar.com/Products/dividendbook.html|",
    "fsNav|1|Fund Spy| //mfi.morningstar.com/FundSpy/SpyPurchase.aspx|",
    "sbNav|1|Five Rules for Successful Stock Investing|//www.morningstar.com/Products/Store_StocksBook.html|",
    "lbNav|1|Little Book|//www.morningstar.com/Products/LittleBook.html|",
    "allBNav|1|All Books|//www.morningstar.com/products/Store_Books.html|"
);

researchToolNavItems = new Array(
    "RTNav|0|Research Tools|javascript:OpenClose('RTNav', 'RTNavList')|",
    "mfbNav|1|Mutual Funds Binder|//www.morningstar.com/Products/Store_MFB.html|",
    "pNav|1|Premium|//members.morningstar.com/memberstpages/fvplanding.html|",
    "allRNav|1|All Research Tools|//www.morningstar.com/products/Store_ResearchTools.html|"
);

workshopNavItems = new Array(
    "WKRNav|0|Education and Training Events|javascript:OpenClose('WKRNav', 'WKRNavList')|",
    "wsNav|1|Web Seminars|//www.morningstar.com/Products/store_workshop.html|",
    "iwsNav|1|Stocks Forum &amp; Workshops|//www.morningstar.com/Products/store_stockforum.html|",
    "itNav|1|One-on-One Investor Training|https://www.morningstarinvestortraining.com/wt.php?m_token=d3260ac1e53b49c7b199970021dde9b6|",
    "allWNav|1|All Education and Training Events|//www.morningstar.com/products/Store_Workshops.html|"
);

seeAllNavItems = new Array(
    "allNav|0|See All Products by Topic|javascript:OpenClose('allNav', 'SeeAllList')|",
    "fpNav|1|Fund Products|//www.morningstar.com/products/Store_FundsProduct.html|",
    "spNav|1|Stock Products|//www.morningstar.com/products/Store_StocksProduct.html|",
    "etfPNav|1|ETF Products|//www.morningstar.com/products/Store_ETFsProduct.html|",
    "pfpNav|1|Personal Finance|//www.morningstar.com/products/Store_PFsProduct.html|"
);

backToStore = new Array("backTS|0|Store Homepage|//www.morningstar.com/products/Store_StoreCoverPage.html|");

leftNavItems = new Array( newsletterNavItems, booksNavItems, workshopNavItems, researchToolNavItems, seeAllNavItems, backToStore);

outerDivIds = new Array('NewsLetterNavList', 'BookNavList', 'WKRNavList', 'RTNavList', 'SeeAllList', 'backToStore');

function ShowStoreLeftNav(id)
{
    var html = "";
    
    for (i=0; i<leftNavItems.length; ++i)
    {
        var htmlMiddle = "";
        var flag = 0;
        
        for (j=1; j<leftNavItems[i].length; ++j)
        {
            var items = leftNavItems[i][j].toString().split('|');
            htmlMiddle = htmlMiddle +  "<div class='LeftNavSub'><a href=\"" + items[3] + "\" id='" + 
                         items[0] + "' class='";
            if (id != items[0])
            {
                htmlMiddle = htmlMiddle + "LeftNavSubOff'";
                
            }else
            {
                htmlMiddle = htmlMiddle + "LeftNavSubOn'";
                flag = 1;
             }
             if (items[0] == "pNav" || items[0] == "itNav")
             {
                htmlMiddle = htmlMiddle + "target=_blank";
             }
             
             htmlMiddle = htmlMiddle + ">" + items[2] + "</a></div>";
             
        }

        var headItem = leftNavItems[i][0].toString().split('|');
        var htmlBegin = "<div><div class='LeftNav'>";
        htmlBegin = htmlBegin + "<a href=\"" +  headItem[3] + "\" ";
        if (flag == '0')
        {
            htmlBegin = htmlBegin + "class='LeftNavOff' id='" + headItem[0] + "'>"
                        + headItem[2] + "</a></div><div id='" + outerDivIds[i] + "' style='display:none'>";
        }else
        {
            htmlBegin = htmlBegin + "class='LeftNavOn' id='" + headItem[0] + "'>" 
                        + headItem[2] + "</a></div><div id='" + outerDivIds[i] + "'>";
        }            
        
        var htmlEnd = "</div></div>";
        
        html = html + htmlBegin + htmlMiddle + htmlEnd;
    }
    
    html = "<div class='LeftNavWrap'>"+ html + "</div>";
    
    document.write(html);

}

