function animateSlider(toVal){ window.clearInterval(animationID); var animationID = window.setInterval( function(){ var toX = toVal; var thx = Element.getStyle('sliderThumb', 'left' ); var thx = parseFloat(thx); if(toX > thx){ x = doDecel(toX,thx); $('sliderThumb').style.left=(thx + x)+'px'; } else if(toX < thx){ x = doDecel(toX,thx); $('sliderThumb').style.left=(thx - x)+'px'; } else if(thx==toX){ $('sliderThumb').style.left=(toX)+'px'; var toX = ""; window.clearInterval(animationID); } } ,1); function doDecel(toX,thx) { dif = Math.abs(toX - thx); if(dif < 70){ x = 1; } else { x = 68; } return x; } } function animateScroller(toVal){ window.clearInterval(sliderInterval); var sliderInterval = window.setInterval( function(){ var toX = toVal; var thx = Element.getStyle('scrollList', 'left' ); var thx = parseInt(thx); if(toX > thx){ x = doDecel(toX,thx); $('scrollList').style.left=(thx + x)+'px'; } else if(toX < thx){ x = doDecel(toX,thx); $('scrollList').style.left=(thx - x)+'px'; } else if(thx==toX){ $('scrollList').style.left=(toX)+'px'; var toX = ""; window.clearInterval(sliderInterval); } } ,4); function doDecel(toX,thx) { dif = Math.abs(toX - thx); if(dif < 70 ){ x = 1; } else { x = 75; } return x; } }