var position=0; //counter initialization. Do not change this line.
var scrollingstring; //This variable will store the string to scroll. Do not change this line.
var showlen=43;	//length of scrolling area
var delay=110; //adjusts speed. 70 is the default value.

function startticker(newstring,newspeed) //tasks to perform before running ticker
{
	scrollingstring=newstring.unescapeHtml();
	delay=newspeed;
	//Do not allow display length to be longer than string length - causes script to hang
	if (showlen>scrollingstring.length)
	{
		showlen=scrollingstring.length;
	}
	//Add a third of the display length's size in spaces to the front of the string to make wrapping look nice
	var spacecounter=showlen/3;
	while (spacecounter>0)
	{
		scrollingstring=" "+scrollingstring;
		spacecounter--;
	}
	runticker();
}	

function runticker() //Infinitely looping function runs ticker
{
	if (position > (scrollingstring.length-showlen)) //wrap code - add bit of end to bit of start when within showlen characters of the end of the string
	{
		changetext((scrollingstring.substr(position,(scrollingstring.length-(position))))+scrollingstring.substr(0,showlen-(scrollingstring.length-(position))));
	}
	else //normal code when wrapping is not necessary
	{
		changetext(scrollingstring.substr(position,showlen));
	}
	if (position==scrollingstring.length) //reset when end is reached
	{
		position=0;
	}
	else
	{
		position++;
	}
	setTimeout("runticker()",delay);
}
		
function changetext(string) //function changes value in a textbox
{
	document.forms['tickerform'].tickerbox.value = string;
}

/*Thanks Paul Schreiber!*/
String.prototype.unescapeHtml = function () {
    var temp = document.createElement("div");
    temp.innerHTML = this;
    var result = temp.childNodes[0].nodeValue;
    temp.removeChild(temp.firstChild);
    return result;
} 

/*
************************************************
78c0538e39d6072e1171734da2449e6ed9862f38
39bc121668a630adedda6c08255860d58daedeaf
************************************************
*/