Auto-Selecting Navigation works for active page but how to add class to parent menu items?

Auto-Selecting Navigation works for active page but how to add class to parent menu items?

I am following this article http://docs.jquery.com/Tutorials:Auto-Selecting_Navigation

I am able to successfully add a class to the active page menu item but does anyone know how to modify or add to this script so that any parent menu items also get the active class?

here is my menu structure and code so far

* Menu *

<ul class="topLevel">
  <li><a href="/one.html">one</a></li>
  <li><a href="/two.html">two</a></li>
  <li><a href="/three.html">three</a></li>
  <li><a href="/four/">four</a>
    <ul class="secondLevel">
      <li><a href="/four/one.html">four-one</a></li>
      <li><a href="/four/two.html">four-two</a></li>
      <li><a href="/four/three.html">four-three</a></li>
      <li><a href="/four/four.html">four-four</a></li>
      <li><a href="/four/five/">four-five</a>
        <ul class="thirdLevel">
          <li><a href="/four/five/one.html">four-five-one</a></li>
          <li><a href="/four/five/two.html">four-five-two</a></li>
          <li><a href="/four/five/three.html">four-five-three</a></li>
          <li><a href="/four/five/four.html">four-five-four</a></li>
          <li><a href="/four/five/five.html">four-five-five</a></li>
        </ul>
      </li>
      <li><a href="/four/sdf/five.html">four-five</a></li>
    </ul>
  </li>
  <li><a href="/five.html">five</a></li>
</ul>

* script *

$(function(){
   var path = location.pathname.substring(1);
   if ( path )
     $('.topLevel a[href$="' + path + '"]').attr('class', 'underline');
 });


Ideally I would like to avoid using the level indicator css class i.e. (class="secondLevel) when setting the parent items.

Has anyone tackled this problem yet? Is this even possible?