var scrollTimer = null;
var scrollDelta = 3;
var scrollDeltaLarge = 50;
var scrollInterval = 50;
var scrolling = false;

function __doScroll(id, offset, timer) {
	el = document.getElementById(id);

	if(scrolling) {
		el.scrollTop += offset;
		if(timer) scrollTimer = window.setTimeout("__doScroll('" + id + "', " + offset + ", true)", scrollInterval);
	}
}

function scrollUp(el, url, id) {
	el.src = url;
	scrolling = true;
	__doScroll(id, -scrollDelta, true);
}

function scrollDown(el, url, id) {
	el.src = url;
	scrolling = true;
	__doScroll(id, scrollDelta, true);
}

function noScroll(el, url) {
	scrolling = false;
	window.clearTimeout(scrollTimer);
	el.src = url;
}

function initScroll(id) {
	el = document.getElementById(id);
	if(el) el.scrollTop = 0;
}

