
// WebTicker by Mioplanet
// www.mioplanet.com

TICKER_CONTENT = document.getElementById("TICKER").innerHTML;
 
TICKER_RIGHTTOLEFT = false;
TICKER_SPEED = 2;
TICKER_STYLE = "";
TICKER_PAUSED = false;

ticker_start();

function ticker_start() {
	var tickerSupported = false;
	TICKER_WIDTH = document.getElementById("TICKER").style.width;
	var img = "<img src=ticker_space.gif width="+TICKER_WIDTH+" height=0>";

/*	// Firefox
	if (navigator.userAgent.indexOf("Firefox")!=-1 || navigator.userAgent.indexOf("Safari")!=-1) {
		document.getElementById("TICKER").innerHTML = "<TABLE  cellspacing='0' cellpadding='0' width='100%'><TR><TD nowrap='nowrap'>"+img+"<SPAN style='"+TICKER_STYLE+"' ID='TICKER_BODY' width='100%'>&nbsp;</SPAN>"+img+"</TD></TR></TABLE>";
		tickerSupported = true;
	}*/
	// IE
//	if (navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")==-1) {
	if (document.getElementById || document.all) {
		document.getElementById("TICKER").innerHTML = "<DIV style='white-space: nowrap; position: relative;' ID='TICKER_BODY'></DIV>";
		tickerSupported = true;
	}
	if(!tickerSupported) document.getElementById("TICKER").outerHTML = ""; else {
		document.getElementById("TICKER_BODY").style.left = (TICKER_RIGHTTOLEFT ? document.getElementById("TICKER").style.width - document.getElementById("TICKER").offsetWidth : 0) + "px";
		document.getElementById("TICKER_BODY").innerHTML = TICKER_CONTENT;
		TICKER_tick();
	}
}

function TICKER_tick() {
	var tickBody = document.getElementById("TICKER_BODY");

	if(!TICKER_PAUSED)
		tickBody.style.left = (tickBody.offsetLeft - (TICKER_SPEED * (TICKER_RIGHTTOLEFT ? -1 : 1))) + "px";

	/*if(TICKER_RIGHTTOLEFT && tickBody.offsetLeft <= 0) 
		tickBody.style.left = (tickBody.offsetWidht) - document.getElementById("TICKER_BODY").offsetWidth) + "px";*/

	// I hate this type of thing but both Firefox and Opera give tickBody.offsetWidth as the width of the initially displayed area of the div, not the entire content area
	var compare = window.opera || navigator.userAgent.indexOf("Firefox") != -1 ? -200 : 0;

	if(!TICKER_RIGHTTOLEFT && tickBody.offsetLeft + tickBody.offsetWidth <= compare)
		tickBody.style.left = document.getElementById("TICKER").offsetWidth + "px";

	window.setTimeout("TICKER_tick()", 30);
}

// toggle display of the details element
function toggle() {
	var d = document.getElementById("details");

	d.style.display = (d.style.display == "block") ? "none" : "block";
}
