UltimateParent 2.1
This snippet travels up the document tree from a specified document and returns the "ultimate" parent.

Parameters
&id The id of the document whose parent you want to find.
&top The top node for the search.
&topLevel The top level node for the search (root = level 1)
Examples

[[UltimateParent? &id=`45` &top=`6`]]
Will find the ultimate parent of document 45 if it is a child of document 6; otherwise it will return 45.
[[UltimateParent? &topLevel=`2`]]
Will find the ultimate parent of the current document at a depth of 2 levels in the document hierarchy, with the root level being level 1.