=== modified file 'includes/menu.inc'
--- includes/menu.inc	2009-09-30 13:09:29 +0000
+++ includes/menu.inc	2009-10-04 20:51:41 +0000
@@ -776,17 +776,27 @@ function _menu_link_translate(&$item) {
  *   provides aggregator_feed, aggregator_category, contact, filter_format,
  *   forum_term, menu, menu_link, node, taxonomy_vocabulary, user. See the
  *   relevant {$type}_load function for more on each. Defaults to node.
- * @param $position
- *   The position of the object in the path, where the first path segment is 0.
- *   For node/%node, the position of %node is 1, but for comment/reply/%node,
- *   it's 2. Defaults to 1.
+ * @param $count
+ *   Optional which object to return in case there is more than one.
+ *   For example foo/%node/bar/%node, the node after foo is 0, the node after
+ *   bar is 1.
  * @param $path
  *   See menu_get_item() for more on this. Defaults to the current path.
+ * @return
+ *   A loaded object if found or NULL.
  */
-function menu_get_object($type = 'node', $position = 1, $path = NULL) {
+function menu_get_object($type = 'node', $count = 0, $path = NULL) {
   $router_item = menu_get_item($path);
-  if (isset($router_item['load_functions'][$position]) && !empty($router_item['map'][$position]) && $router_item['load_functions'][$position] == $type . '_load') {
-    return $router_item['map'][$position];
+  $target = $type . '_load';
+  if ($router_item['load_functions']) {
+    foreach ($router_item['load_functions'] as $key => $function) {
+      if ($function == $target) {
+        if (!$count) {
+          return isset($router_item['map'][$key]) ? $router_item['map'][$key] : NULL;
+        }
+        $count--;
+      }
+    }
   }
 }
 

