function scroller(content, divId, separator){
	this.tickerid			= divId; 	//ID of ticker div to display information
	this.mouseoverBol		= 0; 		//Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
	this.hiddendivpointer	= 1; 		//index of message array for hidden div
	this.separator			= separator;
	
	this.content = content[0];
	for(i=1; i<content.length; i++){
		this.content += separator+""+content[i];
	}
	
	document.write('<div id="'+divId+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; " id="'+divId+'1">'+this.content+'</div></div>')
	var scrollerinstance=this

	if (window.addEventListener) //run onload in DOM2 browsers
		window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
	else if (window.attachEvent) //run onload in IE5.5+
		window.attachEvent("onload", function(){scrollerinstance.initialize()})
	else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
		setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

scroller.prototype.initialize=function(){
	this.tickerdiv	= document.getElementById(this.tickerid);
	this.visiblediv	= document.getElementById(this.tickerid+"1");
	
	var scrollerinstance = this
	document.getElementById(this.tickerid).onmouseover	=	function(){ scrollerinstance.mouseoverBol = 1; }
	document.getElementById(this.tickerid).onmouseout	=	function(){ scrollerinstance.mouseoverBol = 0; }
	
	if (window.attachEvent) //Clean up loose references in IE
		window.attachEvent("onunload", function(){ scrollerinstance.tickerdiv.onmouseover = scrollerinstance.tickerdiv.onmouseout = null; } )
			
	this.contentWidth = flevDivPositionValue(this.tickerid+"1", "width");
	this.tickerRight = flevDivPositionValue(this.tickerid, "width");
	
	this.visiblediv.style.left	= "0px";	
	this.visiblediv.style.width	= this.contentWidth+"px";
	
	setTimeout(function(){ scrollerinstance.animate()}, 0)
}


// -------------------------------------------------------------------
// animate()- Move scroller up and in sync
// -------------------------------------------------------------------

scroller.prototype.animate=function(){
	var scrollerinstance = this
	
	if(this.mouseoverBol != 1){
		currentLeft = flevDivPositionValue(this.tickerid+"1", "left");
		if(this.contentWidth <= -currentLeft)
			this.visiblediv.style.left	= this.tickerRight+"px";
		else
			this.visiblediv.style.left	= currentLeft-1+"px";
	}
	setTimeout(function(){scrollerinstance.animate()}, 15);
}

function flevDivPositionValue(sDivID, sPositionProperty) { // v1.0, Marja Ribbers-de Vroed
	var sPositionValue;
	// ***** W3C Compatible DOM (NN6, Mozilla 16, etc.) *****
	if (document.getElementById && !document.all) { //W3C DOM compliant
		var docObj = document.getElementById(sDivID);
		if (document.defaultView != null) { // NS6+ alike
			sPositionValue = document.defaultView.getComputedStyle(docObj, "").getPropertyValue(sPositionProperty);
		}
		else { // Opera 5 alike
			if (sPositionProperty == "height") { sPositionValue = docObj.style.pixelHeight; }
			else if (sPositionProperty == "width") { sPositionValue = docObj.style.pixelWidth; }
			else { sPositionValue = eval("docObj.style." + sPositionProperty); }
		}
		sPositionValue = (sPositionValue == "") ? "0" : sPositionValue;
	}
	// ***** Netscape Navigator 4+ DOM *****
	else if (document.layers) { //NS4+ DOM compliant
		var docObj = eval("MM_findObj('" + sDivID + "')");
		if ((sPositionProperty == "width") || (sPositionProperty == "height")) { sPositionValue = eval("docObj.clip." + sPositionProperty); }
		else { sPositionValue = eval("docObj." + sPositionProperty); }
		sPositionValue = (sPositionValue == "") ? "0" : sPositionValue;
	}
	// ***** Internet Explorer 4+ DOM *****
	else if (document.all) { //IE4+ DOM compliant
		if (sPositionProperty == "width") { sPositionValue = eval(sDivID + ".offsetWidth"); }
		else if (sPositionProperty == "height") { sPositionValue = eval(sDivID + ".offsetHeight"); }
		else if (sPositionProperty == "top") { sPositionValue = eval(sDivID + ".offsetTop"); }
		else if (sPositionProperty == "left") { sPositionValue = eval(sDivID + ".offsetLeft"); }
		sPositionValue = (sPositionValue == "") ? "0" : sPositionValue;
	}
	if (isNaN(sPositionValue)) { if (sPositionValue.indexOf('px') > 0) { sPositionValue = sPositionValue.substring(0,sPositionValue.indexOf('px')); } }
	return parseInt(sPositionValue);
}


