function switch_display(obj) {
    var sibling = (obj.nextSibling.nodeType==3) ? obj.nextSibling.nextSibling : obj.nextSibling;
    if(sibling.style.display == '' || sibling.style.display=='block') {
	sibling.style.display = 'none';
        obj.lastChild.data = ' [+]';
    } else {
	sibling.style.display = 'block';
        obj.lastChild.data = ' [-]';
    }
}


function prep_collapse() {
    items = window.document.getElementById('rfp-categories');
    labels = items.getElementsByTagName('label');
    for (x=0; x<labels.length; x++) {
        labels[x].appendChild(document.createTextNode(''));
        labels[x].onclick = function() {switch_display(this);};
        switch_display(labels[x]);
    }
}

registerPloneFunction(prep_collapse);
