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