I'm having some difficulty preventing a function from executing.

Here's a scenario:
I have a drop down list that has a sub menu. When you "mouseover" the menu heading, the sub menu expand and when you "mouseout" the menu heading, the submenu collapse.
I also add "mouseover" and "mouseout" listeners to the sub menu.

My trouble is how do I prevent the drop down list from collapsing so that I can get to the sub menu. And only collapse when there is a "mouseout" on both the menu heading and the sub menu?

In short: how do I prevent a function from executing, from inside another function?