﻿
currentvalue =1;   
scrollStep=1

timerLeft=""
timerRight=""

function toLeft(id){
  document.getElementById(id).scrollLeft=0
}

function scrolldivLeft(id){

  clearTimeout(timerRight) 
  document.getElementById(id).scrollLeft+=scrollStep
  timerRight=setTimeout("scrolldivLeft('"+id+"')",10)
}

function scrolldivRight(id){

  clearTimeout(timerLeft)
  document.getElementById(id).scrollLeft-=scrollStep
  timerLeft=setTimeout("scrolldivRight('"+id+"')",10)
}

function scrolldivBottom(id){

  clearTimeout(timerRight)

  document.getElementById(id).scrollTop -= scrollStep
  timerRight=setTimeout("scrolldivBottom('"+id+"')",20)
 
}
function scrolldivTop(id){

  clearTimeout(timerRight)
if(currentvalue == document.getElementById(id).scrollTop)
 document.getElementById(id).scrollTop = 0;
  currentvalue = document.getElementById(id).scrollTop;

  document.getElementById(id).scrollTop += scrollStep
  timerRight=setTimeout("scrolldivTop('"+id+"')",70)
 
}
function Test(id)
{
  clearTimeout(timerRight)

  document.getElementById(id).scrollTop -= scrollStep
  timerRight=setTimeout("Test('"+id+"')",20)

}
function loopDelay(numberMillis) { 
var now = new Date(); 
var exitTime = now.getTime() + numberMillis; 
while (true) { 
now = new Date(); 
if (now.getTime() > exitTime) 
return; 
} 
} 


function scrolldivBottom(id){
  clearTimeout(timerLeft)
  document.getElementById(id).scrollBottom-=scrollStep
  timerLeft=setTimeout("scrolldivBottom('"+id+"')",10)
}

function toRight(id){
  document.getElementById(id).scrollLeft=document.getElementById(id).scrollWidth
}

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