step=2
topOfScroll = 0

function scrollDivDown(id){
clearTimeout(timerDown) 
document.getElementById(id).scrollTop+=step 
timerDown=setTimeout("scrollDivDown('"+id+"')",5)
topOfScroll = document.getElementById(id).scrollTop
if (topOfScroll == document.getElementById('content').scrollHeight - 335) {document.getElementById('scroll-down_img').style.display = 'none'} else {document.getElementById('scroll-down_img').style.display = 'block'}
if (topOfScroll > 0) {document.getElementById('scroll-up_img').style.display = 'block'} else {document.getElementById('scroll-up_img').style.display = 'none'}
} 

function scrollDivUp(id){
clearTimeout(timerUp)
document.getElementById(id).scrollTop-=step 
timerUp=setTimeout("scrollDivUp('"+id+"')",5)
topOfScroll = document.getElementById(id).scrollTop
if (topOfScroll > 0) {document.getElementById('scroll-up_img').style.display = 'block'} else {document.getElementById('scroll-up_img').style.display = 'none'}
if (topOfScroll == document.getElementById('content').scrollHeight - 335) {document.getElementById('scroll-down_img').style.display = 'none'} else {document.getElementById('scroll-down_img').style.display = 'block'}
} 

function scrollDivLeft(id){
  clearTimeout(timerLeft) 
  document.getElementById(id).scrollLeft+=step
  timerLeft=setTimeout("scrollDivLeft('"+id+"')",5)
}

function scrollDivRight(id){
  clearTimeout(timerRight)
  document.getElementById(id).scrollLeft-=step
  timerRight=setTimeout("scrollDivRight('"+id+"')",5)
}

timerDown="" 
timerUp="" 
timerLeft="" 
timerRight="" 

function stopMe(){
clearTimeout(timerDown) 
clearTimeout(timerUp)
}

function stopIt(){
clearTimeout(timerLeft) 
clearTimeout(timerRight)
}

document.onmousemove=function(){stopMe()}