I'm trying to teach myself JS as I do this, so forgive me for asking some beginner questions...

Basically, what I'm trying to do is create a menu structure similar to that used on the current IBM.com homepage (IBM - United States). I'm getting tripped up because it's combining two separate menu formats that I've been able to create separately, but can't seem to merge together.

What I want to do is this:

Clicking a primary menu link will open the submenu box with the submenu choices associated with that primary link

Clicking the same primary menu link again will close the submenu box

Clicking a different primary menu link will cause the submenu to SLIDE within the open box to correspond to the new primary menu button

My issue is basically changing what the primary menu clicks will do — e.g. if the primary menu link matches the submenu being displayed, do one thing (close).