function Ticker(htmlid, text) {
	this.direction = -2.1;
	this.amplify = 5;
	this.frequency = 45;
	this.text = text;
	this.timer = false;
	this.lastRunTime = false;

	this.getE = function (idorobj) {
		if (typeof idorobj == 'string') return document.getElementById(idorobj);
		else return idorobj;
	}
	this.emptyElement = function(elem) {
		while (elem.firstChild) elem.removeChild(elem.firstChild);
	}
	this.createTextDiv = function() {
		this.container.style.overflow = 'hidden';
		this.container.style.textAlign = 'left';
		var qwe = document.createElement('DIV');
		var qwerty = document.createElement('SPAN');
		qwerty.appendChild(document.createTextNode(this.text));
		qwe.appendChild(qwerty);

		qwe.style.cursor = "default";

		this.container.appendChild(qwe);
		qwe.style.position = 'relative';
		qwe.style.width = qwerty.offsetWidth + 'px';
		this.position = Math.round((this.container.offsetWidth/2)-(qwe.offsetWidth/2));
		qwe.style.left = this.position + 'px';
		qwe.style.margin = "0px";
		qwe.style.padding = "0px";
		return qwe;
	}
	this.scrollFunc = function(obj) {
		var now = new Date().getTime();
		var textWidth = this.scrollText.offsetWidth;
		var containerWidth = this.container.offsetWidth;
		if (!this.lastRunTime) this.position = this.position + this.direction;
		else this.position = this.position + ((this.direction / this.frequency) * (now - this.lastRunTime));
		if (this.position+textWidth <= 0) this.position = containerWidth;
		obj.scrollText.style.left = Math.round(this.position) + 'px';
		if ((this.position/obj.amplify) < 0) {
			var opacity = (1 - (Math.abs(this.position) / textWidth)) * obj.amplify;
		} else {
			var w = containerWidth - this.position;
			if (w < (textWidth / obj.amplify)) {
				var opacity = (w / textWidth) * obj.amplify;
			} else {
				var opacity = 1;
			}
			
		}
		if (this.isMozilla) {
			obj.scrollText.style.opacity = opacity;
		} else {
			obj.scrollText.style.filter = "alpha(opacity=" + Math.round(opacity * 100) + ")";
		}
		this.lastRunTime = now;
	}
	this.stop = function() {
		if (this.timer) {
			clearInterval(this.timer);
			this.timer = false;
		}
	}
	this.start = function() {
		if (!this.timer) {
			var obj = this;
			this.timer = setInterval(
				function() {
					obj.scrollFunc(obj);
				},
				this.frequency	
			);
		}
	}

	this.container = this.getE(htmlid);
	this.isMozilla = navigator.appName.indexOf('Netscape')!=-1;

	this.emptyElement(this.container)
	this.scrollText = this.createTextDiv();
	this.start();
}
