I am working on a menu that opens/hides divs inside a single page.

What I'm trying to do is apply a class (.active) on a currently clicked menu item as long as div connected to it is opened. As soon as div is closed, or other menu item is selected, class would dissapear / be applied to other menu item.

I tried to go with `$(".your_selector li").addClass("active");` but it does nothing but marks all menu items as active, as you would expect.

How would you tackle that problem? Here is the fiddle <http://jsfiddle.net/4DGUV/3/>

Thanks in advance