$.fn.setupTreeNavigation = function () {
  return this.each(function () {
    // Cache the root of navigation, should be a UL tag.
    var $$ = $(this);
    
    $$.children().each(function () {
      var nestedList = $(this).contents().filter('ul');
      
      if (nestedList) {
        containingLI = nestedList.parent();
        fallbackLink = containingLI.contents().filter('a');
        
        containingLI.css('list-style-image', 'url(skin/img/bullet.nested.png)');
        containingLI.css('padding-left', '8px');
        
        fallbackLink.click(function (e) {
          e.preventDefault();
          nestedList.toggle();
        });

        nestedList.setupTreeNavigation();
      }
    });
  });
};
