Keeping Global & Sub Nav current

Keeping Global & Sub Nav current


Hi,
I have been using this article as a reference:
http://leftlogic.com/lounge/articles/auto-selecting_navigation to keep
my main navigation style changes visible with current page
selections. I am now at the point where I need to have both the
global nav and sub nav showing current states. Currently this is my
code,
$(function(){
var path = location.pathname.substring(1);
$('#subNav a[@href$="' + path + '"]').addClass('on');
$('#globalNavList a[@href$="' + path +
'"]').addClass('on');
});
My current code works but actually highlights the current selected
link. I was using server side code to achieve this by adding classes
but I'd prefer to use jquery.
Thanks in advance for your help.
B