javascript offset value for a image
<p>I am trying to capture a click event on a image (which is a background-image of a div). I have the following code:</p>

<pre><code>findPos:function(obj) { 
          var pos = new Object();
          pos.x = pos.y = 0;        
          if (obj.offsetParent)  
          { 
            do  
            { 
              pos.x += obj.offsetLeft; 
              pos.y += obj.offsetTop; 
            } while (obj = obj.offsetParent); 
          } 
          return pos;
        } 
</code></pre>

<p>The above code returns the same value for the div. However I want to get the coordinates within the div.</p>
