function initTree(root)
  { for(var i=0; i<root.childNodes.length; i++)
      { if(/li/i.test(root.childNodes[i].nodeName))
          { uls = root.childNodes[i].getElementsByTagName('ul');
            if(uls.length)
              { root.childNodes[i].firstChild.onclick = function(e)
                  { target = e?e.currentTarget:window.event?this:null;
                    if(!target) return;
                    ul = (target.parentNode.getElementsByTagName('ul'))[0];
                    if(ul.style.display=='none')
                      { ul.style.display = '';
                        target.className = target.className.replace(/\bcollapsed\b/,' expanded');
                      }
                    else
                      { ul.style.display = 'none';
                        target.className = target.className.replace(/\bexpanded\b/,' collapsed');
                      }

                  };
                uls[0].style.display = 'none';
                root.childNodes[i].firstChild.className += ' collapsed';
                initTree(uls[0]);
              }
          }
      }
  }
