Modify function "clearMenus" to support multi level dropdown menu.