// 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=279

timerLeft=""
timerRight=""

function toLeft(id){
 // setTimeout("document.getElementById(id).scrollLeft=1",150)
 document.getElementById(id).scrollLeft=0
}
function tostepLeft(id){
 // setTimeout("document.getElementById(id).scrollLeft=1",150)
 if (document.getElementById(id).scrollLeft<(scrollStep*3)) document.getElementById(id).scrollLeft+=scrollStep
 else toLeft(id);
}
function tostepRight(id){
 // setTimeout("document.getElementById(id).scrollLeft=1",150)
 if (document.getElementById(id).scrollLeft<(scrollStep*3)) document.getElementById(id).scrollLeft-=scrollStep
 else toLeft(id)
}

function scrollDivLeft(id){
  clearTimeout(timerLeft)
  clearTimeout(timerRight)
  document.getElementById(id).scrollLeft+=scrollStep
  //alert(document.getElementById(id).scrollLeft)
  if (document.getElementById(id).scrollLeft<=(scrollStep*3)) timerRight=setTimeout("scrollDivLeft('"+id+"')",8000)
  else {toLeft(id);timerRight=setTimeout("scrollDivLeft('"+id+"')",8000)}
}

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

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

function stopMe(){
  clearTimeout(timerRight)
  clearTimeout(timerLeft)
}
function init_scroller(id,dir) {
	if (dir=='right') 	timer=setTimeout("autoscroll('"+id+"','"+dir+"')",8000)
	
	else timer=setTimeout("autoscroll('"+id+"','"+dir+"')",8000)
		
	
	
	}
function init_scroller_infini(id) {
	toLeft(id);
	 timer=setTimeout("scrollDivLeft('"+id+"')",8000)
		
	
	
	}

function autoscroll(id,dir) {
	if (dir=='left')	{scrollDivLeft(id);init_scroller(id,'right')}
	else {scrollDivRight(id);init_scroller(id,'left')}
	
	
}
function autoscroll2(id) {
	scrollDivLeft(id);
	autoscroll2(id);
	}
	
	

