step=2
maxSpeed = 3;
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) 
  if(step < maxSpeed)
	step+=0.05;
  document.getElementById(id).scrollLeft+=step
  
  timerLeft=setTimeout("scrollDivLeft('"+id+"')",5)
}

function scrollDivRight(id){
  clearTimeout(timerRight)
  if(step < maxSpeed)
  	step+=0.05;
  document.getElementById(id).scrollLeft-=step

  timerRight=setTimeout("scrollDivRight('"+id+"')",5)
}

function scrollCenter(id){
    document.getElementById(id).scrollLeft = 0;
}


timerDown="" 
timerUp="" 
timerLeft="" 
timerRight="" 

function stopMe(){
clearTimeout(timerDown) 
clearTimeout(timerUp)
}

function stopIt(){
clearTimeout(timerLeft) 
clearTimeout(timerRight)
step = 2;
}

document.onmousemove=function(){stopMe()}  

