// DOM extentions v1.0 // documentation: http://www.dithered.com/javascript/dom_extensions/index.html // license: http://creativecommons.org/licenses/by/1.0/ // code by Chris Nott (chris[at]dithered[dot]com) // offsetTop and offsetLeft corrections // note: IE5 Mac will not include page margins in calculations. function getOffsetTop(element, deep) { return getOffsetProperty(element, 'Top', deep); } function getOffsetLeft(element, deep) { return getOffsetProperty(element, 'Left', deep); } function getOffsetProperty(element, property, deep) { var offsetValue = 0; offsetProperty = 'offset' + property; do { offsetValue += element[offsetProperty]; element = element.offsetParent; } while (deep == true && element != document.body && element != null); return offsetValue; }