<!--
function <dtml-var fieldName>_show() {
    with(document.getElementById('<dtml-var fieldName>_link')) {
        value = 'Hide Add Form';
        onclick = <dtml-var fieldName>_hide;
    }
    document.getElementById('<dtml-var fieldName>_fieldset').style.display='block';
}

function <dtml-var fieldName>_hide() {
    with(document.getElementById('<dtml-var fieldName>_link')) {
        value = 'Add New <dtml-var "widget.label">';
        onclick = <dtml-var fieldName>_show;
    }
    document.getElementById('<dtml-var fieldName>_fieldset').style.display='none';
}

function <dtml-var fieldName>_update(elm) {
    selected = elm.options[elm.selectedIndex].value;
    detail = document.getElementById('<dtml-var fieldName>_destinations');
    for (var i=detail.childNodes.length-1; i >= 0; i--)
        detail.removeChild(detail.childNodes[i]);

<dtml-in types mapping>
    if (selected == "<dtml-var id>") {
<dtml-in destinations>
        var option = document.createElement('option');
        var path = '<dtml-var sequence-item>';
        option.setAttribute('value', path);
        option.appendChild(document.createTextNode(path));
        detail.appendChild(option);
</dtml-in>
    }
</dtml-in>
}

<dtml-var fieldName>_update(document.getElementById('<dtml-var fieldName>_types'));
-->
<dtml-var reference_focus_js>
