forget about jquery, this actually works:

/* calculate distance of dom element from top of screen element (jquery.position().top fails) */
function cumulativeOffset(element) {
    var top = 0, left = 0;
    do {
        top += element.offsetTop  || 0;
        left += element.offsetLeft || 0;
        element = element.offsetParent;
    } while(element);

    return {
        top: top,
        left: left
    };
};

thanks to http://stackoverflow.com/users/17964/eyelidlessness
(Method shamelessly stolen from PrototypeJS; code style, variable names and return value changed to protect the innocent)

http://stackoverflow.com/questions/1480133/how-can-i-get-an-objects-absolute-position-on-the-page-in-javascript

admin