/*
collapsible lists
written by Kae Verens - kverens@contactjuggling.org
*/

if(window.attachEvent)window.attachEvent('onload',cm);
else if(window.addEventListener)window.addEventListener('load',cm,false);

function cm(){
 cmId=0;
 if(!document.getElementsByTagName)return; // reject non-compliant browsers
 a=document.getElementsByTagName('UL');
 for(i=0;a[i];i++){
  if(a[i].getElementsByTagName('UL')){
   // a[i] is an object which has a collapsible list in it
   b=a[i].childNodes;
   for(j=0;b[j];j++){
    if(b[j].nodeName=='LI'){
     d=b[j].getElementsByTagName('ul');
     if(d.length){
      c=document.createElement('a');
      c.setAttribute('href','javascript:cmSwitch("cm'+(cmId)+'")');
      c.setAttribute('id','cm'+(cmId)+'A');
      c.style.display='inline';
      c.innerHTML=' [+]';
      b[j].insertBefore(c,d[0]);
      d[0].setAttribute('id','cm'+(cmId++));
      d[0].style.display='none';
     }
    }
   }
  }
 }
}

function cmSwitch(id){
 a=document.getElementById(id);
 a.style.display=(a.style.display=='block')?'none':'block';
 a=document.getElementById(id+'A');
 a.innerHTML=(a.innerHTML==' [+]')?' [-]':' [+]';
}