This is only a few lines of code but I don't see the problem!

Here is a test page:

Here are the steps to recreate the bug:

1. click a main nav link
2. click a sub nav link to expose the sub sub nav
3. click the same sub nav link to close the sub sub nav
4. click the main nav to close the sub nav
5. start over
6. this time when you go to click a sub nav to expose a sub sub nav it will open then close by itself.

why does it close by itself? it should stay open.

Here's the js. it's a little sloppy, I've been hammering away at this issue and changed code so many times:
Code JavaScript:
        // this element is display:none; by default, attach event after made display:block; by toggleClass above
        $('li.showSub > ul > li > a').click(function(e){
            // slide up all potentially open sub navs
	    // add a class for styles, and slide it down
            if ( $(this).next().is(":visible") ) {
            if  ( $(this).next().is(":hidden") ){