function newsTicker(id, rowHeight, interval, sinterval) {
	var thisObj = this;
	this.box = document.getElementById(id);
	this.box.style.overflow = "hidden";
	this.box.parent = this;

	this.rows = new Array();
	this.descs = new Array();
	this.height = this.box.clientHeight;
	this.width = this.box.clientWidth;
	this.rowH = rowHeight;
	this.interval = interval;
	this.sinterval = sinterval;
	this.timeobj = null;

	if (typeof this.rowH != "number") this.rowH = 25;
	if (typeof this.interval != "number") this.interval = 50;
	if (typeof this.sinterval != "number") this.sinterval = 0;
	if (this.interval < 0) this.interval = 0;
	if (this.sinterval < 0) this.sinterval = 0;

	// Add table
	var Table = this.box.appendChild(document.createElement("TABLE"));
	this.innerBox = Table.appendChild(document.createElement("TBODY"));
	Table.border = 0;
	Table.cellPadding = 0;
	Table.cellSpacing = 0;
	Table.width = "100%";
	Table.onmouseover = function(){thisObj.stop()};
	Table.onmouseout = function(){thisObj.start()};
}

newsTicker.prototype.add = function (link, txt, pubdate, Target) {
	var TR = this.innerBox.appendChild(document.createElement("TR"));
	var TD = TR.appendChild(document.createElement("TD"));
	var A = TD.appendChild(document.createElement("A"));
	var SPAN = TD.appendChild(document.createElement("SPAN"));

	TR.style.height = this.rowH + "px";

	TD.vAlign = "middle";
	TD.align = "left";
	TD.noWrap = true;
	TD.className = "cut";

	A.href = link;
	A.className = "newsTicker";
	A.innerHTML = txt;
	A.title = txt;

	if (typeof Target != "undefined") {
		A.target = Target;
	} else {
		A.target = '_blank';
	}

	var idx = this.rows.length;

	this.rows[idx] = TR;
	this.descs[idx] = desc;
}

newsTicker.prototype.remove = function (idx) {
	if (this.rows.length > idx) {
		return this.innerBox.removeChild(this.rows[idx]);
	}
}

newsTicker.prototype.start = function () {
	if (this.interval == 0) return;

	if(this.box.scrollTop < 1) {
		this.box.scrollTop = 1;
		this.timeobj = setTimeout("(document.getElementById('"+this.box.id+"')).parent.start()", this.interval + this.sinterval);
		return;
	}

	this.box.scrollTop++;

	if (this.box.scrollTop > this.rowH) {
		this.innerBox.appendChild(this.rows[0]);
		this.rows[this.rows.length] = this.rows[0];
		this.rows.shift();

		this.descs[this.rows.length] = this.descs[0];
		this.descs.shift();
		this.box.scrollTop = 1;
	} 

	if(this.sinterval > 0 && this.box.scrollTop == this.rowH) {
		this.timeobj = setTimeout("(document.getElementById('"+this.box.id+"')).parent.start()", this.interval + this.sinterval);
	} else {
		this.timeobj = setTimeout("(document.getElementById('"+this.box.id+"')).parent.start()", this.interval);
	}

}

newsTicker.prototype.stop = function () {
	if (this.timeobj != null) {
		clearTimeout(this.timeobj);
	} 
}
