diff -U3 -r -N drupal.head.orig/database/database.mysql drupal.head.new/database/database.mysql
--- drupal.head.orig/database/database.mysql	2005-11-01 23:10:20 +1100
+++ drupal.head.new/database/database.mysql	2005-11-03 17:11:58 +1100
@@ -817,6 +817,7 @@
 INSERT INTO system VALUES ('modules/comment.module','comment','module','',1,0,0);
 INSERT INTO system VALUES ('modules/filter.module','filter','module','',1,0,0);
 INSERT INTO system VALUES ('modules/help.module','help','module','',1,0,0);
+INSERT INTO system VALUES ('modules/menu.module','menu','module','',1,0,0);
 INSERT INTO system VALUES ('modules/node.module','node','module','',1,0,0);
 INSERT INTO system VALUES ('modules/page.module','page','module','',1,0,0);
 INSERT INTO system VALUES ('modules/story.module','story','module','',1,0,0);
@@ -842,7 +843,7 @@
 REPLACE blocks SET module = 'user', delta = '0', theme = 'bluemarine', status = '1';
 REPLACE blocks SET module = 'user', delta = '1', theme = 'bluemarine', status = '1';
 
-INSERT INTO sequences (name, id) VALUES ('menu_mid', 1);
+INSERT INTO sequences (name, id) VALUES ('menu_mid', 2);
 
 INSERT INTO node_access VALUES (0, 0, 'all', 1, 0, 0);
 
@@ -860,3 +861,7 @@
 INSERT INTO url_alias (src, dst) VALUES ('node/feed', 'rss.xml');
 
 INSERT INTO variable (name, value) VALUES ('node_options_forum', 'a:1:{i:0;s:6:"status";}');
+
+INSERT INTO menu VALUES (2, 0, '', 'Primary links', '', 0, 115);
+INSERT INTO variable VALUES ('menu_primary_menu', 'i:2;');
+INSERT INTO variable VALUES ('menu_secondary_menu', 'i:2;');
diff -U3 -r -N drupal.head.orig/database/database.pgsql drupal.head.new/database/database.pgsql
--- drupal.head.orig/database/database.pgsql	2005-11-01 23:10:20 +1100
+++ drupal.head.new/database/database.pgsql	2005-11-03 17:12:07 +1100
@@ -811,6 +811,7 @@
 INSERT INTO system VALUES ('modules/comment.module','comment','module','',1,0,0);
 INSERT INTO system VALUES ('modules/filter.module','filter','module','',1,0,0);
 INSERT INTO system VALUES ('modules/help.module','help','module','',1,0,0);
+INSERT INTO system VALUES ('modules/menu.module','menu','module','',1,0,0);
 INSERT INTO system VALUES ('modules/node.module','node','module','',1,0,0);
 INSERT INTO system VALUES ('modules/page.module','page','module','',1,0,0);
 INSERT INTO system VALUES ('modules/story.module','story','module','',1,0,0);
@@ -852,10 +853,14 @@
 
 INSERT INTO variable (name, value) VALUES ('node_options_forum', 'a:1:{i:0;s:6:"status";}');
 
+INSERT INTO menu VALUES (2, 0, '', 'Primary links', '', 0, 115);
+INSERT INTO variable VALUES ('menu_primary_menu', 'i:2;');
+INSERT INTO variable VALUES ('menu_secondary_menu', 'i:2;');
+
 ---
 --- Alter some sequences
 ---
-ALTER SEQUENCE menu_mid_seq RESTART 2;
+ALTER SEQUENCE menu_mid_seq RESTART 3;
 
 ---
 --- Functions
diff -U3 -r -N drupal.head.orig/database/updates.inc drupal.head.new/database/updates.inc
--- drupal.head.orig/database/updates.inc	2005-11-01 23:10:21 +1100
+++ drupal.head.new/database/updates.inc	2005-11-03 21:42:41 +1100
@@ -67,7 +67,8 @@
   "2005-09-07" => "update_147",
   "2005-09-18" => "update_148",
   "2005-09-27" => "update_149",
-  "2005-10-15" => "update_150"
+  "2005-10-15" => "update_150",
+  "2005-10-23" => "update_151",
 );
 
 function update_110() {
@@ -919,6 +920,81 @@
   return $ret;
 }
 
+function update_151() {
+  $ret = array();
+
+  $ts = variable_get('theme_settings', null);
+
+  // set up data array so we can loop over both sets of links
+  $menus = array(0 => array('links_var' => 'primary_links',
+                            'toggle_var' => 'toggle_primary_links',
+                            'more_var' => 'primary_links_more',
+                            'menu_name' => t('Primary links'),
+                            'menu_var' => 'menu_primary_menu',
+                            'pid' => 0),
+                 1 => array('links_var' => 'secondary_links',
+                            'toggle_var' => 'toggle_secondary_links',
+                            'more_var' => 'secondary_links_more',
+                            'menu_name' => t('Secondary links'),
+                            'menu_var' => 'menu_secondary_menu',
+                            'pid' => 0));
+
+  for ($loop = 0; $loop <= 1 ; $loop ++) {
+    // create new Primary and Secondary links menus
+    $menus[$loop]['pid'] = db_next_id('{menu}_mid');
+    $ret[] = update_sql("INSERT INTO {menu} (mid, pid, path, title, description, weight, type) " .
+                         "VALUES ({$menus[$loop]['pid']}, 0, '', '{$menus[$loop]['menu_name']}', '', 0, 115)");
+  
+    // insert all entries from theme links into new menus
+    $num_inserted = 0;
+    if (is_array($ts) && is_array($ts[$menus[$loop]['links_var']])) {
+      $links = $ts[$menus[$loop]['links_var']];
+      for ($i = 0; $i < count($links['text']); $i++) {
+        if ($links['text'][$i] != "" && $links['link'][$i] != "") {
+          $num_inserted ++;
+          $node_unalias = db_fetch_array(db_query("SELECT src FROM {url_alias} WHERE dst = '%s'", $links['link'][$i]));
+          if (is_array($node_unalias)) {
+	    $link_path = $node_unalias['src'];
+	  }
+	  else {
+	    $link_path = $links['link'][$i];
+	  }
+
+          $mid = db_next_id('{menu}_mid');
+          $ret[] = update_sql("INSERT INTO {menu} (mid, pid, path, title, description, weight, type) " .
+                               "VALUES ($mid, {$menus[$loop]['pid']}, '$link_path', '{$links['text'][$i]}', '{$links['description'][$i]}', 0, 118)");
+        }
+      }
+      // delete Secondary links if not populated.
+      if ($loop == 1 && $num_inserted == 0) {
+        db_query("DELETE FROM {menu} WHERE mid={$menus[$loop]['pid']}");
+      }
+    }
+  
+    // set menu_primary_menu variable appropriately
+    if (!$ts[$menus[$loop]['toggle_var']] || $num_inserted == 0) {
+      variable_set($menus[$loop]['menu_var'], 0);
+    }
+    else {
+      variable_set($menus[$loop]['menu_var'], $menus[$loop]['pid']);
+    }
+    variable_del($menus[$loop]['toggle_var']);
+    unset($ts[$menus[$loop]['toggle_var']]);
+    variable_del($menus[$loop]['links_var']);
+    unset($ts[$menus[$loop]['links_var']]);
+    variable_del($menus[$loop]['more_var']);
+    unset($ts[$menus[$loop]['more_var']]);
+  }
+  
+  if (is_array($ts)) {
+    variable_set('theme_settings', $ts);
+  }
+
+  $ret[] = update_sql("UPDATE {system} SET status = 1 WHERE name = 'menu'");
+
+  return $ret;
+}
+
 function update_sql($sql) {
   $edit = $_POST["edit"];
   $result = db_query($sql);
diff -U3 -r -N drupal.head.orig/includes/menu.inc drupal.head.new/includes/menu.inc
--- drupal.head.orig/includes/menu.inc	2005-11-03 21:44:31 +1100
+++ drupal.head.new/includes/menu.inc	2005-11-03 21:16:13 +1100
@@ -493,6 +493,25 @@
 }
 
 /**
+ * Returns true when the menu item is in the active trail within a 
+ * specific subsection of the menu tree.
+ *
+ * @param $mid
+ *   The menu item being considered.
+ * @param $pid
+ *   The root of the subsection of the menu tree in which to look.
+ */
+function menu_in_active_trail_in_submenu($mid, $pid) {
+  $trail = _menu_get_active_trail_in_submenu($pid);
+
+  if (!$trail) {
+    return FALSE;
+  }
+
+  return in_array($mid, $trail);
+}
+
+/**
  * Populate the database representation of the menu.
  *
  * This need only be called at the start of pages that modify the menu.
@@ -708,6 +727,125 @@
 }
 
 /**
+ * Returns an array containing the primary links.
+ * Can optionally descend from the root of the Primary links menu towards the 
+ * current node for a specified number of levels and return that submenu.
+ * Used to generate a primary/secondary menu from different levels of one menu.
+ *
+ * @param $start_level
+ *   This optional parameter can be used to retrieve a context-sensitive array
+ *   of links at $start_level levels deep into the Primary links menu. 
+ *   The default is to return the top-level links.
+ * @param $pid
+ *   The parent menu ID from which to search for children. Defaults to the 
+ *   menu_primary_menu setting.
+ * @return An array containing the themed links as the values. The keys of 
+ *   the array contain some extra encoded information about the results.
+ *   The format of the key is {level}-{num}{-active}.
+ *   level is the depth within the menu tree of this list.
+ *   num is the number within this array, used only to make the key unique.
+ *   -active is appended if this element is in the active trail.
+ */
+function menu_primary_links($start_level = 1, $pid = 0) {
+  if (!module_exist('menu')) {
+    return NULL;
+  }
+  if (!$pid) {
+    $pid = variable_get('menu_primary_menu', 0);
+  }
+  if (!$pid) {
+    return NULL;
+  }
+
+  if ($start_level < 1) {
+    $start_level = 1;
+  }
+
+  if ($start_level > 1) {
+    $trail = _menu_get_active_trail_in_submenu($pid);
+    if (!$trail) {
+      return NULL;
+    }
+    else {
+      $pid = $trail[$start_level - 1];
+    }
+  }
+
+  $menu = menu_get_menu();
+  if ($pid && is_array($menu['visible'][$pid]) && array_key_exists('children', $menu['visible'][$pid])) {
+    $count = 1;
+    foreach ($menu['visible'][$pid]['children'] as $cid) {
+      $index = "$start_level-$count";
+      if (menu_in_active_trail_in_submenu($cid, $pid)) {
+        $index .= "-active";
+      }
+      $links[$index] = menu_item_link($cid);
+      $count++;
+    }
+  }
+
+  // special case - provide link to admin/menu if primary links is empty.
+  if (is_null($links) && $start_level == 1 && $pid == variable_get('menu_primary_menu', 0)) {
+    $links['1-1'] = l(t('edit primary links'),'admin/menu');
+  }
+  
+  return $links;
+}
+
+/**
+ * Returns an array containing the secondary links.
+ * Secondary links can be either a second level of the Primary links
+ * menu or generated from their own menu.
+ */
+function menu_secondary_links() {
+  $msm = variable_get('menu_secondary_menu', 0);
+  if ($msm == 0) {
+    return NULL;
+  }
+
+  if ($msm == variable_get('menu_primary_menu', 0)) {
+    return menu_primary_links(2, $msm);
+  }
+  
+  return menu_primary_links(1, $msm);
+}
+
+/**
+ * Returns the themed HTML for primary and secondary links.
+ * Note that this function is overridden by most core themes because 
+ * those themes display links in "link | link" format, not from a list.
+ * Also note that by default links rendered with this function are 
+ * displayed with the same CSS as is used for the local tasks.
+ * If a theme wishes to render links from a ul it is expected that 
+ * the theme will provide suitable CSS.
+ *
+ * @param $links
+ *   An array containing links to render.
+ * @return
+ *   A string containing the themed links.
+ *
+ * @ingroup themeable
+ */
+function theme_menu_links($links) {
+  if (!count($links)) {
+    return '';
+  }
+  $level_tmp = split('-', key($links));
+  $level = $level_tmp[0];
+  $output = "<ul class=\"links-$level\">\n";
+  foreach ($links as $index => $link) {
+    $output .= '<li';
+    if (stristr($index, 'active')) {
+      $output .= ' class="active"';
+    }
+    $output .= ">$link</li>\n";
+  }
+  $output .= '</ul>';
+
+  return $output;
+}
+
+/**
  * @} End of "defgroup menu".
  */
 
@@ -734,6 +872,56 @@
 }
 
 /**
+ * Find the active trail through a specific subsection of the menu tree.
+ *
+ * @param $pid
+ *   The root item from which the active trail must descend.
+ */
+function _menu_get_active_trail_in_submenu($pid) {
+  static $trails;
+  static $built;
+
+  if (!$built) {
+    // Find all menu items which point to the current node and for each
+    // follow the parents up the chain to build an active trail.
+    $built = TRUE;
+    $menu = menu_get_menu();
+    $path = $_GET['q'];
+    $count = 0;
+    while ($path && !$count) {
+      foreach ($menu['items'] as $key => $item) {
+        if (array_key_exists('path', $item) && $item['path'] == $path) {
+          $trails[$count] = array();
+          $mid = $key;
+          while ($mid && $menu['items'][$mid]) {
+            array_unshift($trails[$count], $mid);
+            $mid = $menu['items'][$mid]['pid'];
+          }
+	  $count ++;
+        }
+      }
+      $path = substr($path, 0, strrpos($path, '/'));
+    }
+  }
+
+  if ($trails) {
+    foreach ($trails as $key => $trail) {
+      for ($i = 0 ; $i < count($trail); $i++) {
+        if ($trail[$i] == $pid) {
+	  // create a trail from $pid to the current page inclusive.
+          for ( ; $i < count($trail) ; $i++) {
+	    $subtrail[] = $trail[$i];
+	  }
+          return $subtrail;
+        }
+      }
+    }
+  }
+  
+  return NULL;
+}
+
+/**
  * Comparator routine for use in sorting menu items.
  */
 function _menu_sort($a, $b) {
diff -U3 -r -N drupal.head.orig/includes/theme.inc drupal.head.new/includes/theme.inc
--- drupal.head.orig/includes/theme.inc	2005-11-01 23:10:22 +1100
+++ drupal.head.new/includes/theme.inc	2005-11-03 16:07:08 +1100
@@ -212,8 +212,6 @@
  */
 function theme_get_settings($key = NULL) {
   $defaults = array(
-    'primary_links'                 =>  array(),
-    'secondary_links'               =>  array(),
     'mission'                       =>  '',
     'default_logo'                  =>  1,
     'logo_path'                     =>  '',
@@ -225,8 +223,6 @@
     'toggle_search'                 =>  1,
     'toggle_slogan'                 =>  0,
     'toggle_mission'                =>  1,
-    'toggle_primary_links'          =>  1,
-    'toggle_secondary_links'        =>  1,
     'toggle_node_user_picture'      =>  0,
     'toggle_comment_user_picture'   =>  0,
   );
@@ -307,41 +303,6 @@
       }
     }
 
-    foreach (array('primary', 'secondary') as $type) {
-      // Get the data to populate the textfields, if the variable is not an array .. try to parse the old-style link format.
-      $value = $settings[$type . '_links'];
-
-      // Clear out existing (internal) values
-      $settings[$type .'_links'] = array();
-
-      // Get the amount of links to show, possibly expanding if there are more links defined than the count specifies.
-      $count = variable_get($type . '_link_count', 5);
-      if (isset($value['link']) && $count > sizeof($value['link'])) {
-        $count = sizeof($value['link']);
-      }
-
-      if ($settings['toggle_' . $type . '_links']) {
-        for ($i =0; $i < $count; $i++) {
-          unset($attributes);
-          if (!empty($value['text'][$i])) {
-            if (!empty($value['description'][$i])) {
-              $attributes['title'] = $value['description'][$i];
-            }
-            $text = $value['text'][$i];
-            $link = $value['link'][$i];
-            if (substr($link, 0, 7) == 'http://') {
-              $settings[$type .'_links'][] = '<a href="'. check_url($link) .'"'. drupal_attributes($attributes) .'>'. check_plain($text) .'</a>';
-            }
-            else {
-              $settings[$type .'_links'][] = l($text, $link, $attributes);
-            }
-          }
-        }
-        if ($settings[$type .'_links'] == array()) {
-          $settings[$type .'_links'] = array(l(t('edit %type links', array('%type' => $type)),'admin/themes/settings'));
-        }
-      }
-    }
   }
 
   return isset($settings[$setting_name]) ? $settings[$setting_name] : NULL;
@@ -509,6 +470,9 @@
  *   A string containing the themed links.
  */
 function theme_links($links, $delimiter = ' | ') {
+  if (!is_array($links)) {
+    return '';
+  }
   return implode($delimiter, $links);
 }
 
diff -U3 -r -N drupal.head.orig/modules/menu.module drupal.head.new/modules/menu.module
--- drupal.head.orig/modules/menu.module	2005-11-01 23:10:22 +1100
+++ drupal.head.new/modules/menu.module	2005-11-03 20:58:54 +1100
@@ -47,6 +47,11 @@
       'callback' => 'menu_reset',
       'access' => user_access('administer menu'),
       'type' => MENU_LOCAL_TASK);
+
+    $items[] = array('path' => 'admin/settings/menu',
+      'title' => t('menus'),
+      'callback' => 'menu_configure',
+      'access' => user_access('administer menu'));
   }
 
   return $items;
@@ -84,9 +89,52 @@
       return t('<p>Enter the name for your new menu. Remember to enable the newly created block in the %blocks administration page.</p>', array('%blocks' => l(t('blocks'), 'admin/block')));
     case 'admin/menu/item/add':
       return t('<p>Enter the title, path, position and the weight for your new menu item.</p>');
+    case 'admin/settings/menu':
+      return t('<p>Customize the menu settings.</p>');
   }
 }
 
+
+/**
+ * Menu callback; presents menu configuration options.
+ */
+function menu_configure() {
+  $menu = menu_get_menu();
+  
+  $primary_options[0] = t('No primary links');
+  foreach ($menu['items'][0]['children'] as $mid) {
+    $primary_options[$mid] = $menu['items'][$mid]['title'];
+  }
+
+  $form['settings_links'] = array('#type' => 'fieldset', '#title' => t('Primary links settings'));
+  $form['settings_links']['intro'] = array(
+    '#type' => 'markup',
+    '#value' => t('Primary links is a navigation system which usually (depending on your theme) appears at the top-right of the browser window. There are usually two rows of links, primary and secondary. You may control which links appear in this area by choosing a menu from which the links will be generated and then placing your links into the menu using the <a href="%menu">menu administration</a> or the \'Menu settings\' pane on each edit node form.', array('%menu' => url('admin/menu')))
+  );
+
+  $form['settings_links']['menu_primary_menu'] = array(
+    '#type' => 'select',
+    '#title' => t('choose the menu containing your primary links'),
+    '#default_value' => variable_get('menu_primary_menu', 0),
+    '#options' => $primary_options
+  );
+
+  $secondary_options[0] = t('No secondary links');
+  foreach ($menu['items'][0]['children'] as $mid) {
+    $secondary_options[$mid] = $menu['items'][$mid]['title'];
+  }
+
+  $form['settings_links']['menu_secondary_menu'] = array(
+    '#type' => 'select',
+    '#title' => t('choose the menu containing your secondary links'),
+    '#default_value' => variable_get('menu_secondary_menu', 0),
+    '#options' => $secondary_options,
+    '#description' => t('If you select the same menu as primary links then secondary links will display the appropriate second level of your navigation hierarchy.')
+  );
+
+  return system_settings_form('menu_configure', $form);
+}
+
 /**
  * Implementation of hook_block().
  */
diff -U3 -r -N drupal.head.orig/modules/system.module drupal.head.new/modules/system.module
--- drupal.head.orig/modules/system.module	2005-11-03 21:44:32 +1100
+++ drupal.head.new/modules/system.module	2005-11-03 16:07:08 +1100
@@ -1043,11 +1043,6 @@
 
   // System wide only settings.
   if (!$key) {
-    // Menu settings
-
-    $form['primary_links'] = system_navigation_links_form('primary', 'Primary');
-    $form['secondary_links'] = system_navigation_links_form('secondary', 'Secondary');
-
     // Toggle node display.
     $node_types = module_invoke('node', 'get_types');
     if ($node_types) {
@@ -1066,8 +1061,6 @@
     'toggle_name'                 => t('Site name'),
     'toggle_slogan'               => t('Site slogan'),
     'toggle_mission'              => t('Mission statement'),
-    'toggle_primary_links'        => t('Primary links'),
-    'toggle_secondary_links'      => t('Secondary links'),
     'toggle_node_user_picture'    => t('User pictures in posts'),
     'toggle_comment_user_picture' => t('User pictures in comments'),
     'toggle_search'               => t('Search box'),
@@ -1117,62 +1110,6 @@
 
 }
 
-function system_navigation_links_form($type, $utype) {
-  $settings = theme_get_settings('');
-  $value = $settings[$type . '_links'];
-
-  if (!is_array($value)) {
-    $value = array();
-  }
-  // Increment the link count, if the user has requested more links.
-  if (variable_get($type . '_links_more', false)) {
-    variable_del($type . '_links_more');
-    variable_set($type . '_link_count', variable_get($type . '_link_count', 5) + 5);
-  }
-
-  // Get the amount of links to show, possibly expanding if there are more links defined than the count specifies.
-  $count = variable_get($type . '_link_count', 5);
-  $count = ($count > sizeof($value['link'])) ? $count : sizeof($value['link']);
-
-  if (variable_get($type . '_link_count', 5) != $count) {
-    variable_set($type . '_link_count', $count);
-  }
-  $form = array(
-    '#type' => 'item', '#title' => t('_TYPE_ link settings', array('_TYPE_' => $utype)), '#theme' => 'system_navigation_links_form',
-    '#description' => t('You can specify your _TYPE_ links here, one link per line.<br /> The link text field is the text you want to link.<br /> The url field is the location the link points to.<br /> The description field is an optional description of where the link points.', array('_TYPE_' => $type))
-  );
-
-  $form['#tree'] = TRUE;
-
-  for ($i = 0; $i < $count; $i++) {
-    foreach (array('text', 'link', 'description') as $field) {
-      $form[$field][$i] = array('#type' => 'textfield', '#default_value' => $value[$field][$i], '#size' => 15, '#maxlength' => 90);
-    }
-  }
-
-  $form[$type . '_links_more'] = array(
-    '#type' => 'checkbox', '#title' => t('I need more _TYPE_ links.', array('_TYPE_' => $type)), '#default_value' => FALSE,
-    '#description' => t('Checking this box will give you 5 additional _TYPE_ links.', array('_TYPE_' => $type))
-  );
-  return $form;
-}
-
-function theme_system_navigation_links_form(&$form) {
-  $header = array(t('link text'), t('url'), t('description'));
-  foreach (element_children($form['text']) as $key) {
-    $row = array();
-    $row[] = form_render($form['text'][$key]);
-    $row[] = form_render($form['link'][$key]);
-    $row[] = form_render($form['description'][$key]);
-    $rows[] = $row;
-
-  }
-  $output = theme('table', $header, $rows);
-  $output .= form_render($form);
-  return $output;
-}
-
-
 function search_box() {
   $form['#action'] = url('search');
   $form['keys'] = array('#type' => 'textfield', '#size'=> 15, '#value' => '', '#attributes' => array('alt' => t('Enter the terms you wish to search for.'), 'class' => 'form-text'));
diff -U3 -r -N drupal.head.orig/themes/bluemarine/menu_links.tpl.php drupal.head.new/themes/bluemarine/menu_links.tpl.php
--- drupal.head.orig/themes/bluemarine/menu_links.tpl.php	1970-01-01 10:00:00.000000000 +1000
+++ drupal.head.new/themes/bluemarine/menu_links.tpl.php	2005-11-03 06:44:50 +1100
@@ -0,0 +1,11 @@
+<?php
+
+/**
+ * Render the primary/secondary links in "link | link" format 
+ * instead of the default list.
+ */
+  if (is_array($links)) {
+    echo  implode(' | ', $links);
+  }
+
+?>
diff -U3 -r -N drupal.head.orig/themes/bluemarine/page.tpl.php drupal.head.new/themes/bluemarine/page.tpl.php
--- drupal.head.orig/themes/bluemarine/page.tpl.php	2005-10-07 21:00:00.000000000 +1000
+++ drupal.head.new/themes/bluemarine/page.tpl.php	2005-11-03 16:07:17 +1100
@@ -18,8 +18,8 @@
       <?php if ($site_slogan) { ?><div class='site-slogan'><?php print $site_slogan ?></div><?php } ?>
     </td>
     <td id="menu">
-      <?php if ($secondary_links) { ?><div id="secondary"><?php print theme('links', $secondary_links) ?></div><?php } ?>
-      <?php if ($primary_links) { ?><div id="primary"><?php print theme('links', $primary_links) ?></div><?php } ?>
+      <?php if ($secondary_links) { ?><div id="secondary"><?php print theme('menu_links', $secondary_links) ?></div><?php } ?>
+      <?php if ($primary_links) { ?><div id="primary"><?php print theme('menu_links', $primary_links) ?></div><?php } ?>
       <?php print $search_box ?>
     </td>
   </tr>
diff -U3 -r -N drupal.head.orig/themes/bluemarine/template.php drupal.head.new/themes/bluemarine/template.php
--- drupal.head.orig/themes/bluemarine/template.php	1970-01-01 10:00:00.000000000 +1000
+++ drupal.head.new/themes/bluemarine/template.php	2005-11-03 06:44:50 +1100
@@ -0,0 +1,10 @@
+<?php
+
+/**
+ * Catch the theme_menu_links function, and redirect through the template api.
+ */
+function phptemplate_menu_links($links = array()) {
+  return _phptemplate_callback('menu_links', array('links' => $links));
+}
+
+?>
diff -U3 -r -N drupal.head.orig/themes/chameleon/chameleon.theme drupal.head.new/themes/chameleon/chameleon.theme
--- drupal.head.orig/themes/chameleon/chameleon.theme	2005-11-01 23:10:23 +1100
+++ drupal.head.new/themes/chameleon/chameleon.theme	2005-11-03 16:07:19 +1100
@@ -11,9 +11,7 @@
        'logo',
        'toggle_favicon',
        'toggle_name',
-       'toggle_slogan',
-       'toggle_primary_links',
-       'toggle_secondary_links');
+       'toggle_slogan');
 }
 
 function chameleon_regions() {
@@ -55,8 +53,8 @@
 
   $output .= "</div>\n";
 
-  $primary_links = theme('links', theme_get_setting('primary_links'));
-  $secondary_links = theme('links', theme_get_setting('secondary_links'));
+  $primary_links = theme('links', menu_primary_links());
+  $secondary_links = theme('links', menu_secondary_links());
   if ($primary_links || $secondary_links) {
     $output .= ' <div class="navlinks">';
     if ($primary_links) {
diff -U3 -r -N drupal.head.orig/themes/engines/phptemplate/phptemplate.engine drupal.head.new/themes/engines/phptemplate/phptemplate.engine
--- drupal.head.orig/themes/engines/phptemplate/phptemplate.engine	2005-11-01 23:10:23 +1100
+++ drupal.head.new/themes/engines/phptemplate/phptemplate.engine	2005-11-03 16:07:19 +1100
@@ -130,9 +130,7 @@
     'toggle_mission',
     'toggle_name',
     'toggle_node_user_picture',
-    'toggle_primary_links',
     'toggle_search',
-    'toggle_secondary_links',
     'toggle_slogan'
   );
 }
@@ -200,9 +198,9 @@
     'messages'            => theme('status_messages'),
     'mission'             => isset($mission) ? $mission : '',
     'onload_attributes'   => theme('onload_attribute'),
-    'primary_links'       => theme_get_setting('primary_links'),
+    'primary_links'       => menu_primary_links(),
     'search_box'          => (theme_get_setting('toggle_search') ? search_box() : ''),
-    'secondary_links'     => theme_get_setting('secondary_links'),
+    'secondary_links'     => menu_secondary_links(),
     'sidebar_left'        => $sidebar_left,
     'sidebar_right'       => $sidebar_right,
     'site_name'           => (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''),
diff -U3 -r -N drupal.head.orig/themes/pushbutton/menu_links.tpl.php drupal.head.new/themes/pushbutton/menu_links.tpl.php
--- drupal.head.orig/themes/pushbutton/menu_links.tpl.php	1970-01-01 10:00:00.000000000 +1000
+++ drupal.head.new/themes/pushbutton/menu_links.tpl.php	2005-11-03 06:44:50 +1100
@@ -0,0 +1,11 @@
+<?php
+
+/**
+ * Render the primary/secondary links in "link | link" format 
+ * instead of the default list.
+ */
+  if (is_array($links)) {
+    echo  implode(' | ', $links);
+  }
+
+?>
diff -U3 -r -N drupal.head.orig/themes/pushbutton/page.tpl.php drupal.head.new/themes/pushbutton/page.tpl.php
--- drupal.head.orig/themes/pushbutton/page.tpl.php	2005-10-07 21:00:00.000000000 +1000
+++ drupal.head.new/themes/pushbutton/page.tpl.php	2005-11-03 16:07:21 +1100
@@ -34,7 +34,7 @@
     </td>
 
     <td class="primary-links" width="70%" align="center" valign="middle">
-      <?php print theme('links', $primary_links) ?>
+      <?php print theme('menu_links', $primary_links) ?>
     </td>
   </tr>
 </table>
@@ -42,7 +42,7 @@
 <table id="secondary-menu" summary="Navigation elements." border="0" cellpadding="0" cellspacing="0" width="100%">
   <tr>
     <td class="secondary-links" width="75%"  align="center" valign="middle">
-      <?php print theme('links', $secondary_links) ?>
+      <?php print theme('menu_links', $secondary_links) ?>
     </td>
     <td  width="25%"  align="center" valign="middle">
       <?php print $search_box ?>
@@ -104,16 +104,12 @@
     <td align="center" valign="middle">
     <?php if (is_array($primary_links)) : ?>
       <div class="primary-links">
-        <?php foreach ($primary_links as $link): ?>
-          <?php print $link?> |
-        <?php endforeach; ?>
+        <?php print theme('menu_links', $primary_links) ?>
       </div>
     <?php endif; ?>
     <?php if (is_array($secondary_links)) : ?>
       <div class="secondary-links">
-        <?php foreach ($secondary_links as $link): ?>
-          <?php print $link?> |
-        <?php endforeach; ?>
+        <?php print theme('menu_links', $secondary_links) ?>
       </div>
     <?php endif; ?>
     </td>
diff -U3 -r -N drupal.head.orig/themes/pushbutton/template.php drupal.head.new/themes/pushbutton/template.php
--- drupal.head.orig/themes/pushbutton/template.php	1970-01-01 10:00:00.000000000 +1000
+++ drupal.head.new/themes/pushbutton/template.php	2005-11-03 06:44:50 +1100
@@ -0,0 +1,10 @@
+<?php
+
+/**
+ * Catch the theme_menu_links function, and redirect through the template api.
+ */
+function phptemplate_menu_links($links = array()) {
+  return _phptemplate_callback('menu_links', array('links' => $links));
+}
+
+?>
