(function (c) { var w = c.fn.height, x = c.fn.width; c.fn.extend({ height: function () { this[0] || h(); return this[0] == window ? (c.browser.mozilla || c.browser.opera) && c(document).width() > self.innerWidth ? self.innerHeight - m() : self.innerHeight || c.boxModel && document.documentElement.clientHeight || document.body.clientHeight : this[0] == document ? Math.max(document.body.scrollHeight, document.body.offsetHeight) : w.apply(this, arguments) }, width: function () { this[0] || h(); if (this[0] == window) return (c.browser.mozilla || c.browser.opera) && c(document).height() > self.innerHeight ? self.innerWidth - m() : self.innerWidth || c.boxModel && document.documentElement.clientWidth || document.body.clientWidth; if (this[0] == document) if (c.browser.mozilla) { var a = self.pageXOffset; self.scrollTo(99999999, self.pageYOffset); var b = self.pageXOffset; self.scrollTo(a, self.pageYOffset); return document.body.offsetWidth + b } else return Math.max(document.body.scrollWidth, document.body.offsetWidth); return x.apply(this, arguments) }, innerHeight: function () { this[0] || h(); return this[0] == window || this[0] == document ? this.height() : this.is(":visible") ? this[0].offsetHeight - b(this, "borderTopWidth") - b(this, "borderBottomWidth") : this.height() + b(this, "paddingTop") + b(this, "paddingBottom") }, innerWidth: function () { this[0] || h(); return this[0] == window || this[0] == document ? this.width() : this.is(":visible") ? this[0].offsetWidth - b(this, "borderLeftWidth") - b(this, "borderRightWidth") : this.width() + b(this, "paddingLeft") + b(this, "paddingRight") }, outerHeight: function (a) { this[0] || h(); a = c.extend({ margin: !1 }, a || {}); return this[0] == window || this[0] == document ? this.height() : this.is(":visible") ? this[0].offsetHeight + (a.margin ? b(this, "marginTop") + b(this, "marginBottom") : 0) : this.height() + b(this, "borderTopWidth") + b(this, "borderBottomWidth") + b(this, "paddingTop") + b(this, "paddingBottom") + (a.margin ? b(this, "marginTop") + b(this, "marginBottom") : 0) }, outerWidth: function (a) { this[0] || h(); a = c.extend({ margin: !1 }, a || {}); return this[0] == window || this[0] == document ? this.width() : this.is(":visible") ? this[0].offsetWidth + (a.margin ? b(this, "marginLeft") + b(this, "marginRight") : 0) : this.width() + b(this, "borderLeftWidth") + b(this, "borderRightWidth") + b(this, "paddingLeft") + b(this, "paddingRight") + (a.margin ? b(this, "marginLeft") + b(this, "marginRight") : 0) }, scrollLeft: function (a) { this[0] || h(); return a != void 0 ? this.each(function () { this == window || this == document ? window.scrollTo(a, c(window).scrollTop()) : this.scrollLeft = a }) : this[0] == window || this[0] == document ? self.pageXOffset || c.boxModel && document.documentElement.scrollLeft || document.body.scrollLeft : this[0].scrollLeft }, scrollTop: function (a) { this[0] || h(); return a != void 0 ? this.each(function () { this == window || this == document ? window.scrollTo(c(window).scrollLeft(), a) : this.scrollTop = a }) : this[0] == window || this[0] == document ? self.pageYOffset || c.boxModel && document.documentElement.scrollTop || document.body.scrollTop : this[0].scrollTop }, position: function (a) { return this.offset({ margin: !1, scroll: !1, relativeTo: this.offsetParent() }, a) }, offset: function (a, s) { this[0] || h(); var f = 0, g = 0, i = 0, j = 0, e = this[0], d = this[0], n, q, r = c.css(e, "position"), k = c.browser.mozilla, o = c.browser.msie, l = c.browser.opera, m = c.browser.safari, p = c.browser.safari && parseInt(c.browser.version) > 520, t = !1, u = !1, a = c.extend({ margin: !0, border: !1, padding: !1, scroll: !0, lite: !1, relativeTo: document.body }, a || {}); if (a.lite) return this.offsetLite(a, s); if (a.relativeTo.jquery) a.relativeTo = a.relativeTo[0]; if (e.tagName == "BODY") f = e.offsetLeft, g = e.offsetTop, k ? (f += b(e, "marginLeft") + b(e, "borderLeftWidth") * 2, g += b(e, "marginTop") + b(e, "borderTopWidth") * 2) : l ? (f += b(e, "marginLeft"), g += b(e, "marginTop")) : o && jQuery.boxModel ? (f += b(e, "borderLeftWidth"), g += b(e, "borderTopWidth")) : p && (f += b(e, "marginLeft") + b(e, "borderLeftWidth"), g += b(e, "marginTop") + b(e, "borderTopWidth")); else { do { q = c.css(d, "position"); f += d.offsetLeft; g += d.offsetTop; if (k || o || p) f += b(d, "borderLeftWidth"), g += b(d, "borderTopWidth"), k && q == "absolute" && (t = !0), o && q == "relative" && (u = !0); n = d.offsetParent || document.body; if (a.scroll || k) { do { a.scroll && (i += d.scrollLeft, j += d.scrollTop); if (l && (c.css(d, "display") || "").match(/table-row|inline/)) i -= d.scrollLeft == d.offsetLeft ? d.scrollLeft : 0, j -= d.scrollTop == d.offsetTop ? d.scrollTop : 0; k && d != e && c.css(d, "overflow") != "visible" && (f += b(d, "borderLeftWidth"), g += b(d, "borderTopWidth")); d = d.parentNode } while (d != n) } d = n; if (d == a.relativeTo && !(d.tagName == "BODY" || d.tagName == "HTML")) { k && d != e && c.css(d, "overflow") != "visible" && (f += b(d, "borderLeftWidth"), g += b(d, "borderTopWidth")); if ((m && !p || l) && q != "static") f -= b(n, "borderLeftWidth"), g -= b(n, "borderTopWidth"); break } if (d.tagName == "BODY" || d.tagName == "HTML") { if ((m && !p || o && c.boxModel) && r != "absolute" && r != "fixed") f += b(d, "marginLeft"), g += b(d, "marginTop"); if (p || k && !t && r != "fixed" || o && r == "static" && !u) f += b(d, "borderLeftWidth"), g += b(d, "borderTopWidth"); break } } while (d) } f = v(e, a, f, g, i, j); return s ? (c.extend(s, f), this) : f }, offsetLite: function (a, b) { this[0] || h(); var f = 0, g = 0, i = 0, j = 0, e = this[0], d, a = c.extend({ margin: !0, border: !1, padding: !1, scroll: !0, relativeTo: document.body }, a || {}); if (a.relativeTo.jquery) a.relativeTo = a.relativeTo[0]; do { f += e.offsetLeft; g += e.offsetTop; d = e.offsetParent || document.body; if (a.scroll) { do i += e.scrollLeft, j += e.scrollTop, e = e.parentNode; while (e != d) } e = d } while (e && e.tagName != "BODY" && e.tagName != "HTML" && e != a.relativeTo); f = v(this[0], a, f, g, i, j); return b ? (c.extend(b, f), this) : f }, offsetParent: function () { this[0] || h(); for (var a = this[0].offsetParent; a && a.tagName != "BODY" && c.css(a, "position") == "static"; ) a = a.offsetParent; return c(a) } }); var h = function () { throw "Dimensions: jQuery collection is empty"; }, b = function (a, b) { return parseInt(c.css(a.jquery ? a[0] : a, b)) || 0 }, v = function (a, h, f, g, i, j) { h.margin || (f -= b(a, "marginLeft"), g -= b(a, "marginTop")); if (h.border && (c.browser.safari && parseInt(c.browser.version) < 520 || c.browser.opera)) f += b(a, "borderLeftWidth"), g += b(a, "borderTopWidth"); else if (!h.border && !(c.browser.safari && parseInt(c.browser.version) < 520 || c.browser.opera)) f -= b(a, "borderLeftWidth"), g -= b(a, "borderTopWidth"); h.padding && (f += b(a, "paddingLeft"), g += b(a, "paddingTop")); if (h.scroll && (!c.browser.opera || a.offsetLeft != a.scrollLeft && a.offsetTop != a.scrollLeft)) i -= a.scrollLeft, j -= a.scrollTop; return h.scroll ? { top: g - j, left: f - i, scrollTop: j, scrollLeft: i} : { top: g, left: f} }, l = 0, m = function () { if (!l) { var a = c("<div>").css({ width: 100, height: 100, overflow: "auto", position: "absolute", top: -1E3, left: -1E3 }).appendTo("body"); l = 100 - a.append("<div>").find("div").css({ width: "100%", height: 200 }).width(); a.remove() } return l } })(jQuery);
