//
// SmoothScroll for websites v1.2.1
// Licensed under the terms of the MIT license.
//
!function(){function e(){var e=!1;e&&c("keydown",r),g.keyboardSupport&&!e&&u("keydown",r)}function t(){if(document.body){var t=document.body,n=document.documentElement,o=window.innerHeight,r=t.scrollHeight;if(x=document.compatMode.indexOf("CSS")>=0?n:t,S=t,e(),k=!0,top!=self)b=!0;else if(r>o&&(t.offsetHeight<=o||n.offsetHeight<=o)){var a=!1,i=function(){a||n.scrollHeight==document.height||(a=!0,setTimeout(function(){n.style.height=document.height+"px",a=!1},500))};if(n.style.height="auto",setTimeout(i,10),x.offsetHeight<=o){var l=document.createElement("div");l.style.clear="both",t.appendChild(l)}}g.fixedBackground||v||(t.style.backgroundAttachment="scroll",n.style.backgroundAttachment="scroll")}}function n(e,t,n,o){if(o||(o=1e3),d(t,n),1!=g.accelerationMax){var r=+new Date,a=r-E;if(a<g.accelerationDelta){var i=(1+30/a)/2;i>1&&(i=Math.min(i,g.accelerationMax),t*=i,n*=i)}E=+new Date}if(T.push({x:t,y:n,lastX:0>t?.99:-.99,lastY:0>n?.99:-.99,start:+new Date}),!C){var l=e===document.body,u=function(r){for(var a=+new Date,i=0,c=0,s=0;s<T.length;s++){var d=T[s],f=a-d.start,h=f>=g.animationTime,m=h?1:f/g.animationTime;g.pulseAlgorithm&&(m=p(m));var w=d.x*m-d.lastX>>0,v=d.y*m-d.lastY>>0;i+=w,c+=v,d.lastX+=w,d.lastY+=v,h&&(T.splice(s,1),s--)}l?window.scrollBy(i,c):(i&&(e.scrollLeft+=i),c&&(e.scrollTop+=c)),t||n||(T=[]),T.length?K(u,e,o/g.frameRate+1):C=!1};K(u,e,0),C=!0}}function o(e){k||t();var o=e.target,r=l(o);if(!r||e.defaultPrevented||s(S,"embed")||s(o,"embed")&&/\.pdf/i.test(o.src))return!0;var a=e.wheelDeltaX||0,i=e.wheelDeltaY||0;return a||i||(i=e.wheelDelta||0),!g.touchpadSupport&&f(i)?!0:(Math.abs(a)>1.2&&(a*=g.stepSize/120),Math.abs(i)>1.2&&(i*=g.stepSize/120),n(r,-a,-i),void e.preventDefault())}function r(e){var t=e.target,o=e.ctrlKey||e.altKey||e.metaKey||e.shiftKey&&e.keyCode!==M.spacebar;if(/input|textarea|select|embed/i.test(t.nodeName)||t.isContentEditable||e.defaultPrevented||o)return!0;if(s(t,"button")&&e.keyCode===M.spacebar)return!0;var r,a=0,i=0,u=l(S),c=u.clientHeight;switch(u==document.body&&(c=window.innerHeight),e.keyCode){case M.up:i=-g.arrowScroll;break;case M.down:i=g.arrowScroll;break;case M.spacebar:r=e.shiftKey?1:-1,i=-r*c*.9;break;case M.pageup:i=.9*-c;break;case M.pagedown:i=.9*c;break;case M.home:i=-u.scrollTop;break;case M.end:var d=u.scrollHeight-u.scrollTop-c;i=d>0?d+10:0;break;case M.left:a=-g.arrowScroll;break;case M.right:a=g.arrowScroll;break;default:return!0}n(u,a,i),e.preventDefault()}function a(e){S=e.target}function i(e,t){for(var n=e.length;n--;)z[A(e[n])]=t;return t}function l(e){var t=[],n=x.scrollHeight;do{var o=z[A(e)];if(o)return i(t,o);if(t.push(e),n===e.scrollHeight){if(!b||x.clientHeight+10<n)return i(t,document.body)}else if(e.clientHeight+10<e.scrollHeight&&(overflow=getComputedStyle(e,"").getPropertyValue("overflow-y"),"scroll"===overflow||"auto"===overflow))return i(t,e)}while(e=e.parentNode)}function u(e,t,n){window.addEventListener(e,t,n||!1)}function c(e,t,n){window.removeEventListener(e,t,n||!1)}function s(e,t){return(e.nodeName||"").toLowerCase()===t.toLowerCase()}function d(e,t){e=e>0?1:-1,t=t>0?1:-1,(y.x!==e||y.y!==t)&&(y.x=e,y.y=t,T=[],E=0)}function f(e){if(e){e=Math.abs(e),H.push(e),H.shift(),clearTimeout(N);var t=h(H[0],120)&&h(H[1],120)&&h(H[2],120);return!t}}function h(e,t){return Math.floor(e/t)==e/t}function m(e){var t,n,o;return e*=g.pulseScale,1>e?t=e-(1-Math.exp(-e)):(n=Math.exp(-1),e-=1,o=1-Math.exp(-e),t=n+o*(1-n)),t*g.pulseNormalize}function p(e){return e>=1?1:0>=e?0:(1==g.pulseNormalize&&(g.pulseNormalize/=m(1)),m(e))}var w={frameRate:150,animationTime:400,stepSize:120,pulseAlgorithm:!0,pulseScale:8,pulseNormalize:1,accelerationDelta:20,accelerationMax:1,keyboardSupport:!0,arrowScroll:50,touchpadSupport:!0,fixedBackground:!0,excluded:""},g=w,v=!1,b=!1,y={x:0,y:0},k=!1,x=document.documentElement,S,D,H=[120,120,120],M={left:37,up:38,right:39,down:40,spacebar:32,pageup:33,pagedown:34,end:35,home:36},g=w,T=[],C=!1,E=+new Date,z={};setInterval(function(){z={}},1e4);var A=function(){var e=0;return function(t){return t.uniqueID||(t.uniqueID=e++)}}(),N,K=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(e,t,n){window.setTimeout(e,n||1e3/60)}}(),L=/chrome/i.test(window.navigator.userAgent),q=null;"onwheel"in document.createElement("div")?q="wheel":"onmousewheel"in document.createElement("div")&&(q="mousewheel"),q&&L&&(u(q,o),u("mousedown",a),u("load",t))}();