(function(B){B.fn.extend({_height:B.fn.height,_width:B.fn.width,height:function(D){if(this[0]==window){return self.innerHeight||B.boxModel&&document.documentElement.clientHeight||document.body.clientHeight}if(this[0]==document){return Math.max(document.body.scrollHeight,document.body.offsetHeight)}return this._height(D)},width:function(D){if(this[0]==window){return self.innerWidth||B.boxModel&&document.documentElement.clientWidth||document.body.clientWidth}if(this[0]==document){return Math.max(document.body.scrollWidth,document.body.offsetWidth)}return this._width(D)},innerHeight:function(){return this[0]==window||this[0]==document?this.height():this.is(":visible")?this[0].offsetHeight-A(this,"borderTopWidth")-A(this,"borderBottomWidth"):this.height()+A(this,"paddingTop")+A(this,"paddingBottom")},innerWidth:function(){return this[0]==window||this[0]==document?this.width():this.is(":visible")?this[0].offsetWidth-A(this,"borderLeftWidth")-A(this,"borderRightWidth"):this.width()+A(this,"paddingLeft")+A(this,"paddingRight")},outerHeight:function(){return this[0]==window||this[0]==document?this.height():this.is(":visible")?this[0].offsetHeight:this.height()+A(this,"borderTopWidth")+A(this,"borderBottomWidth")+A(this,"paddingTop")+A(this,"paddingBottom")},outerWidth:function(){return this[0]==window||this[0]==document?this.width():this.is(":visible")?this[0].offsetWidth:this.width()+A(this,"borderLeftWidth")+A(this,"borderRightWidth")+A(this,"paddingLeft")+A(this,"paddingRight")},scrollLeft:function(D){if(D!=undefined){return this.each(function(){if(this==window||this==document){window.scrollTo(D,B(window).scrollTop())}else{this.scrollLeft=D}})}if(this[0]==window||this[0]==document){return self.pageXOffset||B.boxModel&&document.documentElement.scrollLeft||document.body.scrollLeft}return this[0].scrollLeft},scrollTop:function(D){if(D!=undefined){return this.each(function(){if(this==window||this==document){window.scrollTo(B(window).scrollLeft(),D)}else{this.scrollTop=D}})}if(this[0]==window||this[0]==document){return self.pageYOffset||B.boxModel&&document.documentElement.scrollTop||document.body.scrollTop}return this[0].scrollTop},offset:function(E,J){var I=0,H=0,R=0,M=0,S=this[0],G=this[0],F,D,Q=B.css(S,"position"),P=B.browser.mozilla,K=B.browser.msie,U=B.browser.safari,O=B.browser.opera,L=false,N=false,E=B.extend({margin:true,border:true,padding:false,scroll:true,lite:false},E||{});if(E.lite){return this.offsetLite(E,J)}if(S.tagName.toLowerCase()=="body"){I=S.offsetLeft;H=S.offsetTop;if(P){I+=A(S,"marginLeft")+(A(S,"borderLeftWidth")*2);H+=A(S,"marginTop")+(A(S,"borderTopWidth")*2)}else{if(O){I+=A(S,"marginLeft");H+=A(S,"marginTop")}else{if(K&&jQuery.boxModel){I+=A(S,"borderLeftWidth");H+=A(S,"borderTopWidth")}}}}else{do{D=B.css(G,"position");I+=G.offsetLeft;H+=G.offsetTop;if(P||K){I+=A(G,"borderLeftWidth");H+=A(G,"borderTopWidth");if(P&&D=="absolute"){L=true}if(K&&D=="relative"){N=true}}F=G.offsetParent;do{if(E.scroll){R+=G.scrollLeft;M+=G.scrollTop}if(P&&G!=S&&B.css(G,"overflow")!="visible"){I+=A(G,"borderLeftWidth");H+=A(G,"borderTopWidth")}G=G.parentNode}while(G!=F);G=F;if(G.tagName.toLowerCase()=="body"||G.tagName.toLowerCase()=="html"){if((U||(K&&B.boxModel))&&Q!="absolute"&&Q!="fixed"){I+=A(G,"marginLeft");H+=A(G,"marginTop")}if((P&&!L&&Q!="fixed")||(K&&Q=="static"&&!N)){I+=A(G,"borderLeftWidth");H+=A(G,"borderTopWidth")}break}}while(G)}var T=C(S,E,I,H,R,M);if(J){B.extend(J,T);return this}else{return T}},offsetLite:function(L,G){var I=0,H=0,E=0,K=0,J=this[0],F,L=B.extend({margin:true,border:true,padding:false,scroll:true},L||{});do{I+=J.offsetLeft;H+=J.offsetTop;F=J.offsetParent;if(L.scroll){do{E+=J.scrollLeft;K+=J.scrollTop;J=J.parentNode}while(J!=F)}J=F}while(J&&J.tagName.toLowerCase()!="body"&&J.tagName.toLowerCase()!="html");var D=C(this[0],L,I,H,E,K);if(G){B.extend(G,D);return this}else{return D}}});var A=function(D,E){return parseInt(B.css(D.jquery?D[0]:D,E))||0};var C=function(H,G,E,I,D,F){if(!G.margin){E-=A(H,"marginLeft");I-=A(H,"marginTop")}if(G.border&&(B.browser.safari||B.browser.opera)){E+=A(H,"borderLeftWidth");I+=A(H,"borderTopWidth")}else{if(!G.border&&!(B.browser.safari||B.browser.opera)){E-=A(H,"borderLeftWidth");I-=A(H,"borderTopWidth")}}if(G.padding){E+=A(H,"paddingLeft");I+=A(H,"paddingTop")}if(G.scroll){D-=H.scrollLeft;F-=H.scrollTop}return G.scroll?{top:I-F,left:E-D,scrollTop:F,scrollLeft:D}:{top:I,left:E}}})(jQuery);