Event.observe(window, 'load', addDropdowns);

function addDropdowns() {
  // first get all the <li>s under a <ul class="nav">
  var lis = $$('#shopNavBox ul.nav li a');
  
  // now go through each <li> and see if it has a <ul>
  lis.each(function(li) {
    var uls = li.up().select('ul');
    
    // just in case we didn't already
    uls.invoke('hide');
    
    // set a random li property
    li.___down = false;
    
    if (uls.length > 0) {
      // okay we have a <ul>, so make the <li> display the <ul> when we click it
      li.observe('click', function(event) {
        if (li.___down)
          Effect.BlindUp(uls[0]);
        else
          Effect.BlindDown(uls[0]);
        
        li.___down = !li.___down;
        
        event.preventDefault();
      });
    }
  });
  
}

