function fieldset_from_h3(obj) {
    return obj.parentNode.getElementsByTagName('fieldset')[0];
}

document.addEventListener("DOMContentLoaded", function (event) {
    document
        .querySelectorAll('div.inline-related:not(.empty-form) > h3')
        .forEach(x => {
            x.addEventListener("click", ev => fieldset_from_h3(ev.currentTarget).classList.toggle('hidden'), false);
            x.style.cursor = "pointer";
            fieldset_from_h3(x).classList.add('hidden');
        });
});