function & _fetch(&$counter, $params)
  {
    $result =& parent :: _fetch($counter, $params);

    $uri = new uri($_SERVER['PHP_SELF']);

    //we're trimming trailing slashes: thus /root/about == /root/about/

    $uri->set_path(rtrim($uri->get_path(), '/'));

    foreach($result as $key => $data)
    {
      $nav_uri = new uri($data['url']);
      $nav_uri->set_path(rtrim($nav_uri->get_path(), '/'));

      if ($uri->get_host() != $nav_uri->get_host())
        continue;

      if(is_integer($res = $uri->compare_path($nav_uri)))
      {
        if($res >= 0)
          $result[$key]['in_path'] = true;

        if($res == 0)
          $result[$key]['selected'] = true;
      }
    }
    return $result;
  }
 function _compare_with_url($url)
 {
     $uri = new uri($_SERVER['PHP_SELF']);
     //we're trimming trailing slashes: thus /root/about == /root/about/
     $uri->set_path(rtrim($uri->get_path(), '/'));
     $nav_uri = new uri($url);
     $nav_uri->set_path(rtrim($nav_uri->get_path(), '/'));
     if ($uri->get_host() != $nav_uri->get_host()) {
         return false;
     }
     return $uri->compare_path($nav_uri);
 }
	function & map_url_to_node($url, $recursive = false)
	{	
		$tree =& tree :: instance();
				
		$uri = new uri($url);
		
		if(($node_id = $uri->get_query_item('node_id')) === false)
			$node =& $tree->get_node_by_path($uri->get_path(), '/', $recursive);
		else
			$node =& $tree->get_node((int)$node_id);
		
		return $node;
	}