var divHandle = document.getElementById("scrollText");
var saveText = divHandle.innerHTML;

saveText = saveText.toLowerCase();

var line = new Array();
line = saveText.split('<li>');

for (var i = 1; i < line.length; i++) {
	if (line[i].indexOf('</ul>') > -1) {
		line[i] = line[i].substring(0,line[i].indexOf('</li>'));
	}
}

var longestmessage=1
for (i=2;i<line.length;i++){
if (line[i].length>line[longestmessage].length)
longestmessage=i
}

//Auto set scroller width
var tscroller_width=line[longestmessage].length

lines=line.length-1 //--Number of lines

temp="";
nextchar=-1;
nextline=1;
cursor="\\";

function animate(){
if (temp==line[nextline] & temp.length==line[nextline].length & nextline!=lines){
nextline++;
nextchar=-1;
//document.bannerform.banner.value=temp;
document.getElementById("ticker").innerHTML = temp;
temp="";
setTimeout("nextstep()",1000)}
else if (nextline==lines & temp==line[nextline] & temp.length==line[nextline].length){
nextline=1;
nextchar=-1;
//document.bannerform.banner.value=temp;
document.getElementById("ticker").innerHTML = temp;
temp="";
setTimeout("nextstep()",3000)}
else{
nextstep()}}

function nextstep(){

if (cursor=="\\"){
cursor="|"}
else if (cursor=="|"){
cursor="/"}
else if (cursor=="/"){
cursor="-"}
else if (cursor=="-"){
cursor="\\"}


nextchar++;
temp+=line[nextline].charAt(nextchar);
//document.bannerform.banner.value=temp+cursor
document.getElementById("ticker").innerHTML = temp;
setTimeout("animate()",20)}


// thanks http://www.brothercake.com/site/resources/scripts/onload/
if(window.addEventListener) {
	window.addEventListener('load', animate, false); // gecko, safari, konqueror and standard
} else if(document.addEventListener) {
	document.addEventListener('load', animate, false); // opera 7
} else if(window.attachEvent) { // win/ie
	window.attachEvent('onload', animate);
} else { // mac/ie5
	if(typeof window.onload == 'function') {
		var existing = onload;
		window.onload = function() {
			animate();
		}
	} else {
		window.onload = function() {
			animate();
		}
	}
}