Different classes for main and sub-menu?

Question:
How to set-up different classes for main and sub-menu?

The code below should be entered within your template.php file and will give the main menu a class of "topnav" and sub-menus a class of "subnav".

function phoenix_menu_tree($tree) {
return ''. $tree .'';
}

function phoenix_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) {
$class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf'));
if (!empty($extra_class)) {
$class .= ' '. $extra_class;
}
if ($in_active_trail) {
$class .= ' active-trail';
}
$vars['primary_links_tree'] = preg_replace('/'. $link .$menu."";
}

Taxonomy: