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

var timerId;
var scrollSpeed = 50;
var scrollAmnt = 10;
var divId = 'bdy-cpy-div';

function scrollStart(dir) {
	if (timerId) clearInterval(timerId);
	
	if (dir == 'down') {
		timerId = setInterval(scrollDown, scrollSpeed);
	} else if (dir == 'up') {
		timerId = setInterval(scrollUp, scrollSpeed);
	} else {
		alert ('Invalid scroll direction was given.');
	}
}

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

function scrollDown() {
	var theDiv = document.getElementById(divId);
	theHeight = theDiv.scrollHeight;
	theDiv.scrollTop = theDiv.scrollTop + scrollAmnt;
}

function scrollUp() {
	var theDiv = document.getElementById(divId);
	theHeight = theDiv.scrollHeight;
	if (theDiv.scrollTop > 0) {
		theDiv.scrollTop = theDiv.scrollTop - scrollAmnt;
	}
}
