(function(C){var A=C.scrollTo=function(F,E,D){C(window).scrollTo(F,E,D)
};
A.defaults={axis:"y",duration:1};
A.window=function(D){return C(window).scrollable()
};
C.fn.scrollable=function(){return this.map(function(){var G=this.parentWindow||this.defaultView,E=this.nodeName=="#document"?G.frameElement||G:this,F=E.contentDocument||(E.contentWindow||E).document,D=E.setInterval;
return E.nodeName=="IFRAME"||D&&C.browser.safari?F.body:D?F.documentElement:this
})
};
C.fn.scrollTo=function(F,E,D){if(typeof E=="object"){D=E;
E=0
}if(typeof D=="function"){D={onAfter:D}
}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.scrollable().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,D)
})
}function G(P){var O="scroll"+P,Q=M.ownerDocument;
return N?Math.max(Q.documentElement[O],Q.body[O]):M[O]
}}).end()
};
function B(D){return typeof D=="object"?D:{top:D,left:D}
}})(jQuery);