// smoothscroll v0.9.9 // licensed under the terms of the mit license. // people involved // - balazs galambosi: maintainer (changelog.txt) // - patrick brunner (patrickb1991@gmail.com) // - michael herf: ssc_pulse algorithm function ssc_init(){if(!document.body)return;var e=document.body;var t=document.documentelement;var n=window.innerheight;var r=e.scrollheight;ssc_root=document.compatmode.indexof("css")>=0?t:e;ssc_activeelement=e;ssc_initdone=true;if(top!=self){ssc_frame=true}else if(r>n&&(e.offsetheight<=n||t.offsetheight<=n)){ssc_root.style.height="auto";if(ssc_root.offsetheight<=n){var i=document.createelement("div");i.style.clear="both";e.appendchild(i)}}if(!ssc_fixedback){e.style.backgroundattachment="scroll";t.style.backgroundattachment="scroll"}if(ssc_keyboardsupport){ssc_addevent("keydown",ssc_keydown)}}function ssc_scrollarray(e,t,n,r){r||(r=1e3);ssc_directioncheck(t,n);ssc_que.push({x:t,y:n,lastx:t<0?.99:-.99,lasty:n<0?.99:-.99,start:+(new date)});if(ssc_pending){return}var i=function(){var s=+(new date);var o=0;var u=0;for(var a=0;a=ssc_animtime;var h=c?1:l/ssc_animtime;if(ssc_pulsealgorithm){h=ssc_pulse(h)}var p=f.x*h-f.lastx>>0;var d=f.y*h-f.lasty>>0;o+=p;u+=d;f.lastx+=p;f.lasty+=d;if(c){ssc_que.splice(a,1);a--}}if(t){var v=e.scrollleft;e.scrollleft+=o;if(o&&e.scrollleft===v){t=0}}if(n){var m=e.scrolltop;e.scrolltop+=u;if(u&&e.scrolltop===m){n=0}}if(!t&&!n){ssc_que=[]}if(ssc_que.length){settimeout(i,r/ssc_framerate+1)}else{ssc_pending=false}};settimeout(i,0);ssc_pending=true}function ssc_wheel(e){if(!ssc_initdone){ssc_init()}var t=e.target;var n=ssc_overflowingancestor(t);if(!n||e.defaultprevented||ssc_isnodename(ssc_activeelement,"embed")||ssc_isnodename(t,"embed")&&/\.pdf/i.test(t.src)){return true}var r=e.wheeldeltax||0;var i=e.wheeldeltay||0;if(!r&&!i){i=e.wheeldelta||0}if(math.abs(r)>1.2){r*=ssc_stepsize/120}if(math.abs(i)>1.2){i*=ssc_stepsize/120}ssc_scrollarray(n,-r,-i);e.preventdefault()}function ssc_keydown(e){var t=e.target;var n=e.ctrlkey||e.altkey||e.metakey;if(/input|textarea|embed/i.test(t.nodename)||t.iscontenteditable||e.defaultprevented||n){return true}if(ssc_isnodename(t,"button")&&e.keycode===ssc_key.spacebar){return true}var r,i=0,s=0;var o=ssc_overflowingancestor(ssc_activeelement);var u=o.clientheight;if(o==document.body){u=window.innerheight}switch(e.keycode){case ssc_key.up:s=-ssc_arrowscroll;break;case ssc_key.down:s=ssc_arrowscroll;break;case ssc_key.spacebar:r=e.shiftkey?1:-1;s=-r*u*.9;break;case ssc_key.pageup:s=-u*.9;break;case ssc_key.pagedown:s=u*.9;break;case ssc_key.home:s=-o.scrolltop;break;case ssc_key.end:var a=o.scrollheight-o.scrolltop-u;s=a>0?a+10:0;break;case ssc_key.left:i=-ssc_arrowscroll;break;case ssc_key.right:i=ssc_arrowscroll;break;default:return true}ssc_scrollarray(o,i,s);e.preventdefault()}function ssc_mousedown(e){ssc_activeelement=e.target}function ssc_setcache(e,t){for(var n=e.length;n--;)ssc_cache[ssc_uniqueid(e[n])]=t;return t}function ssc_overflowingancestor(e){var t=[];var n=ssc_root.scrollheight;do{var r=ssc_cache[ssc_uniqueid(e)];if(r){return ssc_setcache(t,r)}t.push(e);if(n===e.scrollheight){if(!ssc_frame||ssc_root.clientheight+100?1:-1;t=t>0?1:-1;if(ssc_direction.x!==e||ssc_direction.y!==t){ssc_direction.x=e;ssc_direction.y=t;ssc_que=[]}}function ssc_pulse_(e){var t,n,r;e=e*ssc_pulsescale;if(e<1){t=e-(1-math.exp(-e))}else{n=math.exp(-1);e-=1;r=1-math.exp(-e);t=n+r*(1-n)}return t*ssc_pulsenormalize}function ssc_pulse(e){if(e>=1)return 1;if(e<=0)return 0;if(ssc_pulsenormalize==1){ssc_pulsenormalize/=ssc_pulse_(1)}return ssc_pulse_(e)}var ssc_framerate=150;var ssc_animtime=500;var ssc_stepsize=150;var ssc_pulsealgorithm=true;var ssc_pulsescale=6;var ssc_pulsenormalize=1;var ssc_keyboardsupport=true;var ssc_arrowscroll=50;var ssc_frame=false;var ssc_direction={x:0,y:0};var ssc_initdone=false;var ssc_fixedback=true;var ssc_root=document.documentelement;var ssc_activeelement;var ssc_key={left:37,up:38,right:39,down:40,spacebar:32,pageup:33,pagedown:34,end:35,home:36};var ssc_que=[];var ssc_pending=false;var ssc_cache={};setinterval(function(){ssc_cache={}},10*1e3);var ssc_uniqueid=function(){var e=0;return function(t){return t.ssc_uniqueid||(t.ssc_uniqueid=e++)}}();var ischrome=/chrome/.test(navigator.useragent.tolowercase());if(ischrome){ssc_addevent("mousedown",ssc_mousedown);ssc_addevent("mousewheel",ssc_wheel);ssc_addevent("load",ssc_init)}