// CREDITS:
// PowerTicker with unique setup-wizard for non-programmers
// By Urs Dudli and Peter Gehrig
// Copyright (c) 2001 Peter Gehrig and Urs Dudli. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.24fun.com/fast/index.html
// info@24fun.com
// 4/4/2001

// IMPORTANT:
// If you add this script to a script-library or script-archive
// you have to add a highly visible link to
// http://www.24fun.com/fast/index.html on the webpage
// where this script will be featured

// CONFIGURATION:
// Go to http://www.24fun.com, open category 'text'  
// and configure the script with the intelligent setup-wizard

var speed=20
var i_substring=0
var i_presubstring=0
var i_message=0
var messagecontent=""
var messagebackground=""
var messagepresubstring=""
var messageaftersubstring=""

function initiateticker() {
	if (document.all) {	
		showticker()
	}
	if (document.layers) {
		showticker()
	}
}

function getmessagecontent() {
		messagepresubstring=message[i_message].substring(0,i_presubstring)
		messageaftersubstring=message[i_message].substring(i_presubstring,i_substring)
		messagecontent="<table border=0 cellpadding=0 width="+tickerwidth+" height="+tickerheight+"><tr valign=top><td>"
		messagecontent+="<span style='position:relative; font-family:"+fnt[i_message]+";color:"+fntcolor[i_message]+";font-size:"+fntsize[i_message]+"pt;'>"	
		messagecontent+="<font color='"+fntcolor[i_message]+"'>"
		messagecontent+=messagepresubstring
		messagecontent+="</font>"
		messagecontent+="</a>"
		messagecontent+="</span>"
		messagecontent+="<span style='position:relative; font-family:"+fnt[i_message]+";color:"+fntcolorlastletter[i_message]+";font-size:"+fntsize[i_message]+"pt'>"	
		messagecontent+="<font color='"+fntcolorlastletter[i_message]+"'>"
		messagecontent+=messageaftersubstring
		messagecontent+="</font>"
		messagecontent+="</a>"
		messagecontent+="</span>"

		messagecontent+="</td></tr></table>"
}

function showticker() {
	if (i_substring<=message[i_message].length-1) {
			i_substring++
			i_presubstring=i_substring-1
			if (i_presubstring<0) {i_presubstring00}
			getmessagecontent()
		if (document.all) {
			ticker.innerHTML=messagecontent
			var timer=setTimeout("showticker()", speed)
		}
		if (document.layers) {
			document.tickerroof.document.ticker.document.write(messagecontent)
			document.tickerroof.document.ticker.document.close()
			var timer=setTimeout("showticker()", speed)
		}
	}
	else {
		clearTimeout(timer)
		var timer=setTimeout("changemessage()", standstill)
	}
}

function changemessage() {
	i_substring=0
	i_presubstring=0
	i_message++
	if (i_message>message.length-1) {
		i_message=0
	}
	showticker()
}


if (document.all) {
	document.write('<span ID="tickerroof" style="position:relative;width:'+tickerwidth+'px;height:'+tickerheight+'px;">')
	document.write('<span ID="ticker" style="position:absolute;top:0px;left0px"></span>')
	document.write('</span>')
}
if (document.layers) {
	document.write('<ilayer name="tickerroof" height="'+tickerheight+'" width="'+tickerwidth+'">')
	document.write('<layer name="ticker" top=0 left=0"></layer>')
	document.write('</ilayer>')
	document.close()
}

window.onload=initiateticker
window.onresize=initiateticker
