﻿function RenderSubMenu()
{
    BlockAllSubMenus();
    FocusSubMenu('');
}

function BlockAllSubMenus()
{
        document.getElementById('secondaryNavHome').style.display = 'none';
        document.getElementById('secondaryNavNews').style.display = 'none';
        document.getElementById('secondaryNavInside').style.display = 'none';
        document.getElementById('secondaryNavRecreation').style.display = 'none';
        document.getElementById('secondaryNavNatural').style.display = 'none';
        document.getElementById('secondaryNavCultural').style.display = 'none';
        document.getElementById('secondaryNavEducation').style.display = 'none';
}

function FocusSubMenu(strMenuName)
{
    document.getElementById('secondaryNavHome').style.display = 'block';

    if(strMenuName != '')
    {
        myString = strMenuName;
        rExp = /News/g;
        results = myString.search(rExp)
        
        if(results != -1)
        {
            document.getElementById('secondaryNavHome').style.display = 'none';
            document.getElementById('secondaryNavNews').style.display = 'block';
        }

        myString = strMenuName;
        rExp = /Current/g;
        results = myString.search(rExp)
        
        if(results != -1)
        {
            BlockAllSubMenus();
            FocusSubMenu('');
        }

    //    if(document.getElementById.contains('News'))
    //    {
    //        document.getElementById('secondaryNavHome').style.display = 'none';
    //        document.getElementById('secondaryNavHome').style.display = 'block';
    //    }
        /*if (document.getElementById)
        {
            // this is the way the standards work
            document.getElementById('secondaryNavHome').style.display = 'none';
        }
        else if (document.all)
        {
            // this is the way old msie versions work
            document.all['secondaryNavHome'].style.display = "block";
        }
        else if (document.layers)
        {
            // this is the way nn4 works
            document.layers['secondaryNavHome'].style.display = "block";
        }*/
    }
}

//function SwapSubMenu(strMenuName)
//{
//    if(strMenuName == 'Current')
//    {
//        RenderSubMenu();
//    }
//    else
//    {
//        BlockAllSubMenus();
//    
//        /*if (document.getElementById)
//        {
//            document.getElementById('secondaryNav2').style.display = 'none';
//        }
//        else if (document.all)
//        {
//            document.all[div1].style.display = "block";
//        }
//        else if (document.layers)
//        {
//            document.layers[div1].style.display = "block";
//        }
//        
//        document.getElementById('secondaryNav1').style.display = 'none';
//        document.getElementById('secondaryNav2').style.display = 'block';
//        */
//    }
//}