var mItem = []; 
var mTime = []; 
var mWait = 500; 

function mSet()
{
    var topList = document.getElementsByTagName('div');
    
    var niMenu = mItem.length;
    var szClass, szID;
    
    for (k = 0; k < topList.length; k++)
    {
        if ('sidebar' != topList[k].className)
        {
            continue;
        }
        
        var list = topList[k].getElementsByTagName('div');
        
        for (i = 0; i < list.length; i++)
        {
            if ('subsection' != list[i].className && 'fullmenu' != list[i].className)
            {
                continue;
            }
            
            if (szID = list[i].getAttribute('id'))
            { 
                mItem[niMenu] = szID;

                var itemShow = new Function('mShow(\'' + szID + '\');');
                var itemBlur = new Function('mBlur(\'' + szID + '\');');
                
                list[i].onmouseover = itemShow;
                list[i].onmouseout = itemBlur;
                
                var itemList = list[i].getElementsByTagName('a'); 
                
                for (j = 0; j < itemList.length; j++)
                { 
                    itemList[j].onfocus = itemShow; 
                    itemList[j].onblur = itemBlur; 
                }
                
                niMenu++;
            }
        }
    }
}

function mShow(id)
{
    for (var i = 0; i < mItem.length; ++i)
    { 
        if (
            document.getElementById(mItem[i]).style.display != 'none' &&
            document.getElementById(mItem[i]).className == 'fullmenu' &&
            mItem[i] == id
        ) {
            mClear(mItem[i]);
            document.getElementById(id).style.display = 'block';
            return;
        }
    }

    for (var i = 0; i < mItem.length; ++i)
    { 
        if (document.getElementById(mItem[i]).style.display != 'none')
        { 
            if (mItem[i] != id)
            {
                if (document.getElementById(mItem[i]).className != 'fullmenu')
                {
                    mHide(mItem[i]); 
                }
            }
            else
            {
                mClear(mItem[i]);
            }
        }
    }
    document.getElementById(id).style.display = 'block';
};

function mHide(id)
{
    document.getElementById(id).style.display = 'none'; 
}

function mBlur(id)
{
    mTime[id] = setTimeout('mHide(\'' + id + '\');', mWait); 
} 

function mClear(id)
{
    if (mTime[id])
    {
        clearTimeout(mTime[id]);
        mTime[id] = null;
    }
}
            