(function(e){function m(f){return typeof f=="object"?f:{top:f,left:f}}var k=e.scrollTo=function(f,g,a){k.window().scrollTo(f,g,a)};k.defaults={axis:"y",duration:1};k.window=function(){return e(e.browser.safari?"body":"html")};e.fn.scrollTo=function(f,g,a){if(typeof g=="object"){a=g;g=0}a=e.extend({},k.defaults,a);g=g||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)g/=2;a.offset=m(a.offset);a.over=m(a.over);return this.each(function(){function q(h){n.animate(c,g,a.easing,h&&function(){h.call(this, f)})}function u(h){var j=r?e.browser.opera?document.body:document.documentElement:o;return j["scroll"+h]-j["client"+h]}var o=this,n=e(o),b=f,p,c={},r=n.is("html,body");switch(typeof b){case "number":case "string":if(/^([+-]=)?\d+(px)?$/.test(b)){b=m(b);break}b=e(b,this);case "object":if(b.is||b.style)p=(b=e(b)).offset()}e.each(a.axis.split(""),function(h,j){var l=j=="x"?"Left":"Top",i=l.toLowerCase(),d="scroll"+l,s=o[d],t=j=="x"?"Width":"Height",v=t.toLowerCase();if(p){c[d]=p[i]+(r?0:s-n.offset()[i]); if(a.margin){c[d]-=parseInt(b.css("margin"+l))||0;c[d]-=parseInt(b.css("border"+l+"Width"))||0}c[d]+=a.offset[i]||0;if(a.over[i])c[d]+=b[v]()*a.over[i]}else c[d]=b[i];if(/^\d+$/.test(c[d]))c[d]=c[d]<=0?0:Math.min(c[d],u(t));if(!h&&a.queue){s!=c[d]&&q(a.onAfterFirst);delete c[d]}});q(a.onAfter)})}})(jQuery);
