marqueeInstances = {};

function Marquee (id, initialPosition, delay) {
	this.id = id;
	this.element = getElement("id", this.id);
	this.delay = delay;
	this.initialPosition = initialPosition;
	this.position = initialPosition;

	var els = this.element.style;
	var originalVisibility = els.visibility;
	var originalPosition = els.position;
	els.visibility = 'hidden';
	els.position = 'absolute';
	this.width = this.element.clientWidth;
	els.position = originalPosition;
	els.visibility = originalVisibility;

	marqueeInstances[this.id] = this;
}


Marquee.prototype.start = function() {
	this.repeater = setInterval("marqueeInstances." + this.id + ".move()",this.delay);
}

Marquee.prototype.move = function() {
	if (this.position > (this.width * -1)) {
		this.position = this.position - 2;
	} else {
		this.position = this.initialPosition;
	}
	this.element.style.left = this.position + "px";
}

Marquee.prototype.pause = function() {
	clearInterval(this.repeater);
}

Marquee.prototype.resume = function() {
	this.start();
}

