(function(B){var A=B.scrollTo=function(D,E,F){B(window).scrollTo(D,E,F);};A.defaults={axis:"xy",duration:parseFloat(B.fn.jquery)>=1.3?0:1};A.window=function(D){return B(window).scrollable();};B.fn.scrollable=function(){return this.map(function(){var D=this,E=!D.nodeName||B.inArray(D.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!E){return D;}var F=(D.contentWindow||D).document||D.ownerDocument||D;return B.browser.safari||F.compatMode=="BackCompat"?F.body:F.documentElement;});};B.fn.scrollTo=function(E,F,D){if(typeof F=="object"){D=F;F=0;}if(typeof D=="function"){D={onAfter:D};}if(E=="max"){E=9000000000;}D=B.extend({},A.defaults,D);F=F||D.speed||D.duration;D.queue=D.queue&&D.axis.length>1;if(D.queue){F/=2;}D.offset=C(D.offset);D.over=C(D.over);return this.scrollable().each(function(){var G=this,N=B(G),M=E,L,J={},K=N.is("html,body");switch(typeof M){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px)?$/.test(M)){M=C(M);break;}M=B(M,this);case"object":if(M.is||M.style){L=(M=B(M)).offset();}}B.each(D.axis.split(""),function(O,R){var T=R=="x"?"Left":"Top",P=T.toLowerCase(),U="scroll"+T,S=G[U],Q=R=="x"?"Width":"Height";if(L){J[U]=L[P]+(K?0:S-N.offset()[P]);if(D.margin){J[U]-=parseInt(M.css("margin"+T))||0;J[U]-=parseInt(M.css("border"+T+"Width"))||0;}J[U]+=D.offset[P]||0;if(D.over[P]){J[U]+=M[Q.toLowerCase()]()*D.over[P];}}else{J[U]=M[P];}if(/^\d+$/.test(J[U])){J[U]=J[U]<=0?0:Math.min(J[U],H(Q));}if(!O&&D.queue){if(S!=J[U]){I(D.onAfterFirst);}delete J[U];}});I(D.onAfter);function I(O){N.animate(J,F,D.easing,O&&function(){O.call(this,E,D);});}function H(O){var Q="scroll"+O;if(!K){return G[Q];}var R="client"+O,P=G.ownerDocument.documentElement,S=G.ownerDocument.body;return Math.max(P[Q],S[Q])-Math.min(P[R],S[R]);}}).end();};function C(D){return typeof D=="object"?D:{top:D,left:D};}})(jQuery);