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