Toggles the sub-tree of the given root member.
@private

@param {JQuery} elem - JQuery element (for the root memeber) whose
sub-tree will be toggled.
@param {Boolean} [fold] - If this value is defined, target element's
sub-tree folded state will be set explicitly, instead of toggling the
current state.
function toggleSubTree(elem, fold) {
        fold = typeof fold !== 'boolean'
            ? !elem.hasClass('members-folded') // reverse of current state
            : fold;

        var parent;
        if (fold) {
            parent = elem.addClass('members-folded').parent();
            parent.find('.item-members:first').addClass('no-height');
            parent.find('.item-inner > img.item-tree-parent').attr('src', 'img/tree-folded.png');
            // Even if only one is folded, set state as folded and visual state
            // for fold toolbar button.
            setFoldState(true);
        } else {
            parent = elem.removeClass('members-folded').parent();
            parent.find('.item-members:first').removeClass('no-height');
            parent.find('.item-inner > img.item-tree-parent').attr('src', 'img/tree-parent.png');
        }
    }