/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 9/11/2008
 * @author Ariel Flesler
 * @version 1.4
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
(function(a){function c(a){return typeof a=="object"?a:{top:a,left:a}}var b=a.scrollTo=function(b,c,d){a(window).scrollTo(b,c,d)};b.defaults={axis:"y",duration:1},b.window=function(b){return a(window).scrollable()},a.fn.scrollable=function(){return this.map(function(){var b=this.parentWindow||this.defaultView,c=this.nodeName=="#document"?b.frameElement||b:this,d=c.contentDocument||(c.contentWindow||c).document,e=c.setInterval;return c.nodeName=="IFRAME"||e&&a.browser.safari?d.body:e?d.documentElement:this})},a.fn.scrollTo=function(d,e,f){typeof e=="object"&&(f=e,e=0),typeof f=="function"&&(f={onAfter:f}),f=a.extend({},b.defaults,f),e=e||f.speed||f.duration,f.queue=f.queue&&f.axis.length>1,f.queue&&(e/=2),f.offset=c(f.offset),f.over=c(f.over);return this.scrollable().each(function(){function p(a){var c="scroll"+a,d=b.ownerDocument;return m?Math.max(d.documentElement[c],d.body[c]):b[c]}function o(a){g.animate(l,e,f.easing,a&&function(){a.call(this,d,f)})}var b=this,g=a(b),i=d,k,l={},m=g.is("html,body");switch(typeof i){case"number":case"string":if(/^([+-]=)?\d+(px)?$/.test(i)){i=c(i);break}i=a(i,this);case"object":if(i.is||i.style)k=(i=a(i)).offset()}a.each(f.axis.split(""),function(a,c){var d=c=="x"?"Left":"Top",e=d.toLowerCase(),h="scroll"+d,j=b[h],n=c=="x"?"Width":"Height",r=n.toLowerCase();k?(l[h]=k[e]+(m?0:j-g.offset()[e]),f.margin&&(l[h]-=parseInt(i.css("margin"+d))||0,l[h]-=parseInt(i.css("border"+d+"Width"))||0),l[h]+=f.offset[e]||0,f.over[e]&&(l[h]+=i[r]()*f.over[e])):l[h]=i[e],/^\d+$/.test(l[h])&&(l[h]=l[h]<=0?0:Math.min(l[h],p(n))),!a&&f.queue&&(j!=l[h]&&o(f.onAfterFirst),delete l[h])}),o(f.onAfter)}).end()}})(jQuery)
