// JavaScript Document
/* 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=3

speedCount = 0
speedStep  = 6

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 scrollSpeedDivLeft(id)
{
  clearTimeout(timerRight) 
  document.getElementById(id).scrollLeft+=20
  if(speedCount<speedStep)
  {
  	timerRight=setTimeout("scrollSpeedDivLeft('"+id+"')",10)
	speedCount++;
  }
  else
  {
	timerRight=setTimeout("scrollDivLeft('"+id+"')",10)
   	speedCount=0;	  
  }
}

function scrollSpeedDivRight(id)
{
  clearTimeout(timerLeft)
  document.getElementById(id).scrollLeft-=20
  if(speedCount<speedStep)
  {  
    timerLeft=setTimeout("scrollSpeedDivRight('"+id+"')",10)
	speedCount++;
  }
  else
  {
	timerLeft=setTimeout("scrollDivRight('"+id+"')",10)
   	speedCount=0;	  
  }  
}

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)
}
$(function() {

	$(".scrollable").scrollable();

});


