function Scroller(objectName, target, targetChild, height, distance, halt) {
	this.objectName = objectName;
	this.target = target;
	this.targetChild = targetChild;
	this.height = height;
	this.distance = distance;
	this.halt = halt;
	this.pause = false;
}

Scroller.prototype.setOjbectName = function(objectName) {
	this.objectName = objectName;
}

Scroller.prototype.setTarget = function(target) {
	this.target = target;
}

Scroller.prototype.setTargetChild = function(targetChild) {
	this.targetChild = targetChild;
}

Scroller.prototype.setHeight = function(height) {
	this.height = height;
}

Scroller.prototype.setDistance = function(distance) {
	this.distance = distance;
}

Scroller.prototype.setHalt = function(halt) {
	this.halt = halt;
}

Scroller.prototype.init = function() {
	this.target.style.height = this.height;
	this.target.style.overflow = "hidden";
	this.scrollHeight = this.target.scrollHeight;
	if (this.targetChild == null || this.targetChild == undefined) {
		this.target.appendChild(this.target.lastChild.cloneNode(true));
	} else {
		this.target.appendChild(this.targetChild.cloneNode(true));
	}
	this.target.onmouseover = new Function(this.objectName + ".pause = true;");
	this.target.onmouseout = new Function(this.objectName + ".pause = false;");
}

Scroller.prototype.scroll = function() {
	if (this.pause) return;
	this.target.scrollTop += 1;	
	if (this.distance != null
				&& this.distance != undefined
				&& this.halt != null
				&& this.halt != undefined) {
		if (this.target.scrollTop % this.distance == 0) {
			window.clearInterval(this.windowInterval);
			window.setTimeout(this.objectName + ".startScroll();", this.halt);
		}
	}
	if (this.target.scrollTop == this.scrollHeight) {
		this.target.scrollTop = 0;
	}
}

Scroller.prototype.selfVerify = function() {
	if (this.objectName == null || this.objectName == undefined) {
		alert("objectName is null or undefined.");
		return false;
	}
	if (this.target == null || this.target == undefined) {
		alert("target is null or undefined.");
		return false;
	}
	if (this.targetChild == null || this.targetChild == undefined) {
		alert("targetChild is null or undefined.");
		return false;
	}
	if (this.height == null || this.height == undefined) {
		alert("height is null or undefined.");
		return false;
	}
	return true;
}

Scroller.prototype.start = function() {
	if (!this.selfVerify()) return;
	this.init();
	this.startScroll();
}

Scroller.prototype.startScroll = function() {
	this.windowInterval = window.setInterval(this.objectName + ".scroll();", 40);
}
