﻿/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Mr J | http://www.huntingground.net/ */

scrollStep=1;

timerLeft="";
timerRight="";
positionLeft = 0;

function toLeft(id){
  document.getElementById(id).scrollLeft=0
}

function smoothToLeft(id){
  if(positionLeft != 0)
  {
        clearTimeout(timerLeft);
        document.getElementById(id).scrollLeft = document.getElementById(id).scrollLeft -20;
        positionLeft = document.getElementById(id).scrollLeft;
        timerLeft=setTimeout("smoothToLeft('"+id+"')",1);  
    
  }
  else
  {
    clearTimeout(timerLeft);
  }
  
}
function moveDivToLeft(id){
    if(positionLeft == 814 || positionLeft == 1628 || positionLeft == 2442)
    {
       positionLeft = 1;
     clearTimeout(timerLeft);

    }
    else
    {
        clearTimeout(timerLeft);
        document.getElementById(id).scrollLeft+=11;
        positionLeft = document.getElementById(id).scrollLeft
        timerLeft=setTimeout("moveDivToLeft('"+id+"')",4);           
        
    }    

    
}

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 toRight(id){
  document.getElementById(id).scrollLeft=document.getElementById(id).scrollWidth
}

function stopMe(){
  clearTimeout(timerRight) 
  clearTimeout(timerLeft)
}

