// usage: new Marquee(id, speed); new Marquee('marquee_div', 25);
// 25 seems like a nice speed.
function Marquee(element_id, speed) {
		this._box = document.getElementById(element_id); // This is the marquee's container
		this._width = 0;                                 // The width of the marquee's content
		this._pb_offset = 0;                             // The width of the white space in front of the content
		this._speed = speed;                             // How fast the marquee should move

		// init settings for the marquee container
		this._box.style.overflow = 'hidden';
		this._box.scrollLeft = 0;

		// These are the things we want to scroll.  For now it's expecting paragraph tags.
		// I tried '*' but got bad results when something like <p>some <strong>text</strong> was given.
		// So this will just have to be an assumtion for now.
		var sections = this._box.getElementsByTagName('p')
		for(var i=0;i < sections.length; i++) {
			sections[i].style.whiteSpace = 'nowrap';
			sections[i].style.padding = '0';
			sections[i].style.margin = '0';
			sections[i].style.cssFloat = 'left';
			sections[i].style.styleFloat = 'left';
			this._width += sections[i].offsetWidth;
		}

		// This is a box that will push the everything to the right (when starting)
		this._pb_offset = this._box.offsetWidth + 100;
		var padding_box = '<div style="float: left; width:'+this._pb_offset+'px;">&nbsp;</div>';
		this._box.innerHTML = '<div style="width:'+(this._width+(this._pb_offset*2))+'px;">'+padding_box+this._box.innerHTML+padding_box+'</div>';

		// bind *this* to a local variable b/c "this" will not reference the correct object from inside the delayed function call
		// (variable laundering... do we know any coke dealers?)
		var mthis = this;
		setInterval(function(){ mthis.scroll_horizontal(); }, this._speed);
}
Marquee.prototype.scroll_horizontal = function() {
		if (this._box.scrollLeft >= (this._width+this._pb_offset)) this._box.scrollLeft = 0;
		this._box.scrollLeft += 2;
}
