title: Determine the position of an element relative to a positioned ancestor of its offset parent
body: <p>I want to determine <code>#target</code>'s offset relative to <code>#a</code> in the following HTML document – i.e., I want to find the values of <code>x</code> and <code>y</code>:</p>
  
  <p><a href="http://dl.dropbox.com/u/2792776/screenshots/2012-06-09_1814.png" rel="noreferrer">http://dl.dropbox.com/u/2792776/screenshots/2012-06-09_1814.png</a></p>
  
  <p>jQuery has <code>position()</code>, but <code>$("#target").position()</code> returns <code>#target</code>'s offset relative to its offset parent, which is <code>#c</code> (not <code>#a</code>)</p>
  
  <p>I need a function that's equivalent to <code>$.fn.position()</code>, but instead returns the position relative to an "offset ancestor" of the target, rather than its direct offset parent. For example: <code>$("#target").positionRelativeTo("#a")</code></p>