﻿// JScript File

function crawlMenu(menuID)
{
    var menu = document.getElementById(menuID);
    if (menu == null) { return; }

    var anchors = menu.getElementsByTagName("A");
    
    for (var i = 0; i < anchors.length; i++)
    {
        // the 65535 is for a weird situation with IE; apparently, it regards that as "true"
        if ((anchors[i].getAttribute("disabled", 2) == 65535) || anchors[i].getAttribute("disabled") == "true")
        {
            anchors[i].className = "disabled";
            
            // this is kind of a lame way to detect items on popout menus
            // in ie, it's just 'none', but in firefox it's 'none none none none'
            if (anchors[i].style.borderStyle == 'none' || anchors[i].style.borderStyle == 'none none none none')
            {
                // we need to go to tr that contains the table that contains all of this
                var row = anchors[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
                row.style.display = 'none';
            }
            
            // we need to traverse out and look for a td in our parent's parent
            var dropouts = anchors[i].parentNode.parentNode.getElementsByTagName("IMG");
            
            for (var j = 0; j < dropouts.length; ++j)
            {
                dropouts[j].className = "disabled_drop"
            }
        }
    }
}