function subnav(){
   var title;
   var links;
   var nav = document.getElementById('subnav');
   if(nav.hasChildNodes()){
      var children = nav.childNodes;
      for (var i = 0; i < children.length; i++){
         var tag = children[i].nodeName;
         if(tag.match('H2')){
            title = children[i]; 
            }else{
            if(children[i].style){ children[i].style.display = 'none'; }
            if(tag.match('UL')){
               links = children[i];
               }
            }
         if(links && links.hasChildNodes()){
            var children = links.childNodes;
            for (var i = 0; i < children.length; i++){
               var tag = children[i].nodeName;
               if(tag.match('LI')){
                 children[i].onclick = function(){ dropdown(); }
                 children[i].onkeypress = function(){ dropdown(); }
                 }
               }
            }
         }
      title.style.display = 'block';
      title.id = 'subnav_title';
      title.setAttribute('class', 'closed');
      title.onclick=function(){dropdown();return false;}
      title.onkeypress=function(){dropdown();return false;}
      }
   }

function dropdown(){
   var title = document.getElementById('subnav_title');
   var clas = title.getAttribute('class');
   if(clas.match('open')){ subnav(); }
   if(clas.match('closed')){
      var nav = document.getElementById('subnav');
      var children = nav.childNodes;
      for (var i = 0; i < children.length; i++){
        if(children[i].style){ children[i].style.display = 'block'; }
        }
      title.setAttribute('class', 'open');
      }
   }
