﻿function IESafeOffsetParent(g) { try { return g.offsetParent } catch (d) { return document.body } } jQuery.fn.offset = function() { function g(h) { d(jQuery.curCSS(h, "borderLeftWidth", true), jQuery.curCSS(h, "borderTopWidth", true)) } function d(h, n) { k += parseInt(h, 10) || 0; l += parseInt(n, 10) || 0 } var k = 0, l = 0, c = this[0], a; if (c) with (jQuery.browser) { a = c.parentNode; var i = c, b = IESafeOffsetParent(c), e = c.ownerDocument, m = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent), f = jQuery.curCSS, j = f(c, "position") == "fixed"; for (d(c.offsetLeft, c.offsetTop); b; ) { d(b.offsetLeft, b.offsetTop); if (mozilla && !/^t(able|d|h)$/i.test(b.tagName) || safari && !m) g(b); if (!j && f(b, "position") == "fixed") j = true; i = /^body$/i.test(b.tagName) ? i : b; b = b.offsetParent } for (; a && a.tagName && !/^body|html$/i.test(a.tagName); ) { /^inline|table.*$/i.test(f(a, "display")) || d(-a.scrollLeft, -a.scrollTop); mozilla && f(a, "overflow") != "visible" && g(a); a = a.parentNode } if (m && (j || f(i, "position") == "absolute") || mozilla && f(i, "position") != "absolute") d(-e.body.offsetLeft, -e.body.offsetTop); j && d(Math.max(e.documentElement.scrollLeft, e.body.scrollLeft), Math.max(e.documentElement.scrollTop, e.body.scrollTop)); a = { top: l, left: k} } return a };