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

