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