/****************************************************** 
 *  DIV Scroller
 *-----------------------------------------------------
 * Written by: Web International
 * Date: Aug 14, 2007
 *
 ******************************************************/

var timerId;
var scrollSpeed = 50;
var scrollAmnt = 10;
var divId;


function scrollStart(dir, workingDiv) {
        divId = workingDiv;
	if (timerId) clearInterval(timerId);
	
	if (dir == 'left') {
		timerId = setInterval(scrollLeft, scrollSpeed);
	} else if (dir == 'right') {
		timerId = setInterval(scrollRight, scrollSpeed);
	} else {
		alert ('Invalid scroll direction was given.');
	}
}

function scrollStop() {
	if (timerId) {
		 clearInterval(timerId);
		 timerId = 0;
	}
}

function scrollRight() {
	var theDiv = document.getElementById(divId);
	theWidth = theDiv.scrollWidth;
	theDiv.scrollLeft = theDiv.scrollLeft + scrollAmnt;
}

function scrollLeft() {
	var theDiv = document.getElementById(divId);
	theWidth = theDiv.scrollWidth;
	if (theDiv.scrollLeft > 0) {
		theDiv.scrollLeft = theDiv.scrollLeft - scrollAmnt;
	}
}

