
function browseInit() {
  // We are assuming we start off in a proper state
  // Change the expand/collapse links
  lis = $('root_list').getElementsByTagName('li');
  for(i = 0; i < lis.length; i++) {
    arrowLink = lis[i].getElementsByTagName('a').item(0);
    if(lis[i].getElementsByTagName('ul').length < 1) 
      continue;
    arrowLink.href='#';
    arrowLink.onclick = function() {
      var liNode = this.parentNode.parentNode;
      var arrowImg = this.getElementsByTagName('img').item(0);
      childList = liNode.getElementsByTagName('ul').item(0);
      Element.toggle(childList);
      if(liNode.className == 'collapsed') {
        liNode.className = 'expanded';
        arrowImg.setAttribute('src', 'images/arrow_down.gif');
      } else {
        liNode.className = 'collapsed';
        arrowImg.setAttribute('src', 'images/arrow_right.gif');
      }
      return false;
    }
  }
}
