var Scroll={D:0,T:0,I:0,W:0,Timer:null,Init:function(){$('a[href^="#"]').not('.nosc').click(function(){Scroll.Stop();var a=this.href,D=0,H=a.substr(a.indexOf('#')+1,a.length);if(H!='pageTop'){var e=document.getElementById(H);if(!e)return;D=e.offsetTop-6;while(e=e.offsetParent)D+=e.offsetTop}Scroll.D=D;Scroll.T=$(window).scrollTop();Scroll.I=$('body').innerHeight()+20;Scroll.W=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;Scroll.Start();return false});$('body').click(Scroll.Stop)},Start:function(){var D=Scroll.D,T=Scroll.T,I=Scroll.I,W=Scroll.W,O=T+Math.round((D>T)?Math.max(1,Math.min(Math.min((D-T)/4.5,(I-W-T)/4.5),I/8)):-Math.min(Math.max(1,Math.abs((T-D)/4.5)),I/8));window.scrollTo(0,O);if(Math.abs(T-D)<=1||O-1==I-W){Scroll.Stop();window.scrollTo(0,D)}else{Scroll.T=O;Scroll.Timer=setTimeout(Scroll.Start,20)}},Stop:function(){if(Scroll.Timer)clearTimeout(Scroll.Timer)}};$(Scroll.Init)
