code: public static String getRelativeParent(String path, int level)
     {
        int idx = path.length();
        while (level > 0)
        {
           idx = path.lastIndexOf('/', idx - 1);
           if (idx < 0)
           {
              return "";
           }
           level--;
        }
        return (idx == 0) ? "/" : path.substring(0, idx);
     }
docs: Returns the n<sup>th</sup> relative parent of the path, where n=level.
  <p>
  Example:<br>
  <code>
  Text.getRelativeParent("/foo/bar/test", 1) == "/foo/bar"
  </code>
  
  @param path
  the path of the page
  @param level
  the level of the parent
  @return String relative parent