How can ik make submenu's dissapear?

here’s my menu so far

http://www.bldd.nl/kirupa/website-questions3.swf

when you click page 2 > page2c>page 2c1>

and then an other menu item the submenu don’t dissapear

I am using this function to create the submenu’s, but how do i handle the removeMovieClip if a menu item doesn’t have a submenu


function generateSubMenu(container, submenuName, x, depth, node_xml, animateBG, clrBG) {
/*
- if the node equals menu we need a submenu
- we need a background color
- animate the background just once going in and once going out if we have selected another nav item
- enable/disable curr menu item
- level 1 and level 2 submenus?
*/
	//first delete every previous created submenu
	//container[submenuName].removeMovieClip();
	var animateBG:Boolean;
	var clrBG;
	var curr_node:XML;
	var curr_item:MovieClip;
	var curr_menu = container.createEmptyMovieClip(submenuName, depth);
	trace(container);
	//skip the first two node by setting i = 2;
	for (var i = 2; i<node_xml.childNodes.length; i++) {
		k = i-2;
		//hack to skip the first two nodes
		curr_item = curr_menu.attachMovie("menuitem", "item"+i+"_mc", i);
		curr_item._x = x;
		//every submenu starts at y:225
		curr_item._y = 225+(k*40);
		curr_item.trackAsMenu = true;
		curr_node = node_xml.childNodes*;
		//all 
		curr_item.pageTitle = curr_node.childNodes[0].firstChild.nodeValue;
		curr_item.gotoURL = curr_node.attributes.gotoURL;
		curr_item.menuTxt.text = curr_item.pageTitle;
		curr_item.pageContent = curr_node.childNodes[1].firstChild.nodeValue;
		curr_item.pageXML = curr_node;
		//
		var images:Array;
		curr_item.images = [];
		if (curr_node.childNodes[2].nodeName == 'images') {
			//check for this page images
			//trace("submenu num of imgs: "+curr_node.childNodes[2].childNodes.length);
			for (j=0; j<curr_node.childNodes[2].childNodes.length; j++) {
				trace("test: "+j+" "+curr_node.childNodes[2].childNodes[j].firstChild.nodeValue);
				curr_item.images[j] = curr_node.childNodes[2].childNodes[j].firstChild.nodeValue;
			}
		}
		curr_item.onRelease = function() {
			//enable all websiteContent.mainMenu
			menuItemsReset(node_xml.childNodes.length, curr_menu);
			//disable selected
			this.enabled = false;
			//if nodename is menu
			 //not sure here the submenus need to be 5px apart
			//_x equals submenu width: 145
			//x = websiteContent.subMenuBG._x +websiteContent.subMenuBG._width +5;
			xPos = curr_item._x + 155;
			//draw a bg inside the MC which holds your submenu.
			if (this.pageXML.nodeName == "menu") {
				//boolean animate background
				//drawSubBG(this.getNextHighestDepth()+1, curr_menu, "subMenuBG", clrBG, xPos, 225, 145, 210, animateBG);
				
				//thisDepth = websiteContent.swapDepths(websi
				generateSubMenu(websiteContent, "subsubmenu_mc", xPos, websiteContent.getNextHighestDepth(), this.pageXML, 0, 0xFF0000);
				releaseMenu(this, this.gotoURL, this.pageTitle);
			} else if((this.pageXML.nodeName == "page")) { 
			 	trace("No menu just a page");				
				releaseMenu(this, this.gotoURL, this.pageTitle);
				//remove submenus
		if(websiteContent.subsubmenu_mc.subsubmenu_mcBG) {
					trace("Exist so delete");
			//websiteContent.subsubmenu_mc.removeMovieClip();
				}
			}
			
		}
	}
	//x and y position of our submenu
	xPos = curr_item._x;
	yPos = 225;
	//draw our background
	drawSubBG(0, curr_menu, [submenuName+"BG"], 0xFCCBAC, xPos, yPos, 145, 210, animateBG, 1);
}