Slider menu reset problem

I have a site that i’m building in flash. the main (level0) has 2 slider menu buttons on it. basically a buton that you press and the menu slides out from it then when you click one of the menue buttons it automatically slides back it and goes to the linked page. if you just press the main button and do not choose one of the menu items rather, go to the 2nd slider bar without closing the first bar, the first bar stays open. I need some AS that when the user clicks a menu button to go to a page it will check to see which state the otehr slider bar is in and if it is in the open state to close it . the buttons are built with mc’s and the submenu buttons have AS as below:

on (press) {
if (selected == “wwd”) {
break;
} else {
loadMovieNum(“wwd.swf”, 2);
}
selected = “wwd”;
trace(selected);
gotoAndPlay(15);
}
on (rollOver) {
unloadMovieNum(1);
loadMovieNum(“navigatewwd.swf”, 1);
}
on (rollOut) {
unloadMovieNum(1);
loadMovieNum(“infocenter.swf”, 1);
}

any ideas would be great.