/*! Simple animated 'Go to Top' scroll by cara-tm.com, MIT license. */
var distance=300, link='gotop',
D=document,_h=(D.body.clientHeight||D.documentElement.clientHeight),_dis=Math.max(D.body.scrollHeight,D.documentElement.scrollHeight,D.body.offsetHeight,D.documentElement.offsetHeight,D.body.clientHeight,D.documentElement.clientHeight,D.body.scrollHeight),_el=document.getElementById(link);window.onscroll=function(){_el.className=(window.pageYOffset||D.documentElement.scrollTop)>_dis-_h-distance?'visible':''},_el.onclick=function(){function d(){k=new Date().getTime()-p,f>k&&(g.scrollTop=q-q*(1-Math.cos(k/f*Math.PI))/2,j=setTimeout(function(){d()},10))}var f=_h+100,g='BackCompat'==D.compatMode?D.body:D.documentElement;0===g.scrollTop&&(g=D.body);var j,k,l=g.scrollTop,p=new Date().getTime(),q=l;return clearTimeout(j),d(),!1};

/*! Simple animated 'Go to Top' scroll by cara-tm.com, MIT license. */
var distance=300, link='gotop',
D=document,_h=(D.body.clientHeight||D.documentElement.clientHeight),_dis=Math.max(D.body.scrollHeight,D.documentElement.scrollHeight,D.body.offsetHeight,D.documentElement.offsetHeight,D.body.clientHeight,D.documentElement.clientHeight,D.body.scrollHeight),_el=document.getElementById(link);if(typeof(_el)!='undefined'&&_el!=null){window.onscroll=function(){_el.className=(window.pageYOffset||D.documentElement.scrollTop)>_dis-_h-distance?'visible':''},_el.onclick=function(){function d(){k=new Date().getTime()-p,f>k&&(g.scrollTop=q-q*(1-Math.cos(k/f*Math.PI))/2,j=setTimeout(function(){d()},10))}var g='BackCompat'==D.compatMode?D.body:D.documentElement;0===g.scrollTop&&(g=D.body);var j,k,l=g.scrollTop,p=new Date().getTime(),q=l;return clearTimeout(j),d(),!1};}

Update GoTop.min.js