How to apply theme_menu_tree to only the top  menu I am using the following function in the template.php (drupal 7) to override the original menu output. However, the  tags in all levels are also affected. I wonder how to only apply it to the top/first  tag? Please advise. Thanks!

function THEMENAME_menu_tree__MAIN_MENU($variables) {
  return '&lt;ul id="myid" class="menu myclass"&gt;' . $variables['tree'] . '&lt;/ul&gt;';
}
In order to theme the top level ul tag only:

function THEMENAME_menu_tree__menu_top_menu(&amp;$variables) {
 return '&lt;ul class="menu myclass"&gt;' . $variables['tree'] . '&lt;/ul&gt;';
}


You have to put this piece of code in your custom theme's template.php file and replace THEMENAME with your theme's name.