function Scroll(id, speed) {
	this.speed = speed;
	this.oDiv = document.getElementById(id);
	this.content = this.oDiv.innerHTML;
	this.scroll_layer = "<div id='scroller_" + id + "' style='position: relative;'>" + this.content + "</div>";
	this.oDiv.innerHTML = this.scroll_layer;
	this.oScroll = document.getElementById('scroller_' + id);
	this.start();
}

Scroll.prototype.paused = false;

Scroll.prototype.oDiv = new Object();
Scroll.prototype.oScroll = new Object();

Scroll.prototype.content = "";
Scroll.prototype.scroll_layer = "";
Scroll.prototype.mask_height = 0;

Scroll.prototype.speed = 1;

Scroll.prototype.start = function() {
	this.paused = false;
	this.mask_height = this.oDiv.offsetHeight;
	
	this.oScroll.style.position = 'relative';
	this.oScroll.style.top = this.mask_height + "px";
	this.oScroll.style.left = 0;
	
	this.scroll();
};

Scroll.prototype.pause = function() {
	this.paused = true;
};

Scroll.prototype.resume = function() {
	this.paused = false;
};

Scroll.prototype.scroll = function() {
	if (!this.paused) {
		this.oScroll.style.top = (parseInt(this.oScroll.style.top) - this.speed) + "px";
		if (parseInt(this.oScroll.offsetTop) <= this.oDiv.offsetTop - this.oScroll.offsetHeight) {
			this.oScroll.style.top = this.mask_height + "px";
		}
	}
	
	var _self = this;
	window.setTimeout(function() {
			_self.scroll();
			}, 30);
};

Scroll.prototype.showContent = function() {
	alert(this.content);
};

