/**
 * @param contentDiv The id of a <div> containing the content that is to be scrolled
 * @param viewportDiv The id of a <div> within which the content should be displayed
 */
function ScrollingDiv(contentDiv, viewportDiv) {
	this.speed = 1;			// How many pixels it should move each time
	this.frequency = 60;	// How often (in ms) it should move 
	this.offset = 0;
	
	var that = this;
	this.pause = false;
	this.content = document.getElementById(contentDiv);
	this.viewport = document.getElementById(viewportDiv);
	this.content.onmouseover = function() {that.pause = true;};
	this.content.onmouseout = function() {that.pause = false;};
	this.viewport.style.overflow = 'hidden';
	
	this.scroll = function() {
		if (that.pause) {
			window.setTimeout(that.scroll, 500);
			return;
		}
		that.offset -= that.speed;
		if ((that.offset * -1) > that.content.scrollHeight)
			that.offset = 0;
		that.content.style.top = that.offset + 'px';
		window.setTimeout(that.scroll, that.frequency);
	}
	
	this.scroll();
}

