_menu = function()
{
    this.parent_subs = '';

    this.show_subs = function(parent_id,linkobject)
    {		
        this.linkobject = linkobject;
        this.show_sub_id = parent_id;
        this.get_parent_subs();
    }

    this.hide_all_subs = function()
    {
        var _subs = document.getElementsByTagName('DIV');
        for( var i = _subs.length-1 ; i > -1; i--)
        {
            if(_subs[i].id && (_subs[i].id != this.show_sub_id) && (_subs[i].id.substr(0,4) == 'sub_' || _subs[i].id.substr(0,4) == 'ddb_') && ( this.parent_subs.indexOf( _subs[i].id ) < 0 )  ) 
            {
                _subs[i].style.display = 'none';
            }
        }

        this.appear();

    }

    this.appear = function()
    {
        if(getE(this.show_sub_id)) 
        {
            getE(this.show_sub_id).style.display = '';
        }
    }

    this.get_parent_subs = function()
    {
        var _parent = this.linkobject.parentNode;
        var _parent_subs = true;

        this.parent_subs = '';	
    
        while(_parent_subs == true)
        {
            if(_parent)
            {
                if(_parent.id && _parent.id.substr(0,4) == 'sub_')	
                {
                    this.parent_subs += _parent.id + ',';										
                }
            }				
            if(_parent.parentNode) _parent = _parent.parentNode;
            else _parent_subs = false;				
        }		
        setTimeout('_menu.hide_all_subs()',600);
    }

    this.clear_subs = function()
    {
        this.clearTO = setTimeout('_menu.clear_all()',600);
    }

    this.clear_all = function()
    {
        _menu.show_sub_id = 'NULL';
        _menu.parent_subs = 'NULL';	
        _menu.hide_all_subs();
    }

    this.clear_timeout = function()
    {
        clearTimeout(this.clearTO);
    }

}

_menu = new _menu();
