//--------------------------------------------------------------------------------------->
//------ If you made it this far into my code then you should know that I need to  ------>
//--- credit the folks at http://www.javafile.com for getting me started with this ------>
//---- the scripts original author & title is "** The Headliner by  Jan Pijnacker **" --->
//--------------------------------------------------------------------------------------*/

// Delay in milliseconds for the expanding headliner
expandWait=120

// Delay in milliseconds for the scrolling headliner
scrollWait=55

// Number of characters in scrolling zone for the scrolling headliner
scrollWidth=69

// Number of lines, specify as many as needed to load the array
lineMax=6
lines=new Array(lineMax)

// Color and font properties are in the CSS sheet under the class name of NewsTicker3R

// Define the lines with parameters in this order(Text to display, url, effect(Expand, Scroll, or Static), time to wait)
lines[1]=new Line("*** The Three Rivers District News Ticker ***", "http://threerivers.nsbsa.org", Static, 1500)
lines[2]=new Line("The Oct OLS Training has been cancelled, click here for more details","http://www.threerivers.nsbsa.org/disttraining.htm", Scroll, 3000)
lines[3]=new Line("*** The Three Rivers District News Ticker ***", "http://www.threerivers.nsbsa.org/disttraining.htm", Static, 1500)
lines[4]=new Line("The Oct OLS Training has been cancelled, click here for more details", "http://threeriversbsaswim.org/index.html", Scroll, 3000)
lines[5]=new Line("*** The Three Rivers District News Ticker ***", "http://threerivers.nsbsa.org", Static, 1500)
lines[6]=new Line("The Oct OLS Training has been cancelled, click here for more details","http://www.threerivers.nsbsa.org/disttraining.htm", Scroll, 3000)

// initilization of a bunch of strange variables to empty, null, or 0 (just don't change)
lineText=""
timerID=null
timerRunning=false
spaces=""
charNo=0
charMax=0
charMiddle=0
lineNo=0
lineWait=0

// Define line object
function Line(text, url, type, wait, color) 
	{
		this.text=text
		this.url=url
		this.Display=type
		this.wait=wait
    }

// Fill a string with num (number) of c (chars) 
function StringFill(c, num) 
	{
		s=""
		while (--num >= 0) 
			{
				s+=c
			}
		return s
	}

// the static effect
function Static() 
	{
	    document.formDisplay.buttonFace.value=this.text
	    timerID=setTimeout("ShowNextLine()", this.wait)
	}

// the expand effect
function Expand() 
	{
		lineText=this.text
		charMax=lineText.length
		charMiddle=Math.round(charMax / 2)
		lineWait=this.wait
		TextExpand()
	}

// getting the text into the effect
function TextExpand() 
	{
		if (charNo <= charMiddle) 
			{
				document.formDisplay.buttonFace.value=lineText.substring(charMiddle - charNo, charMiddle + charNo)
				charNo++
				timerID=setTimeout("TextExpand()", expandWait)
			}
		else 
			{
				charNo=0
				timerID=setTimeout("ShowNextLine()", lineWait)
			}
	}

//the scroll effect
function Scroll() 
	{
		spaces=StringFill(" ", scrollWidth)
		lineText=spaces+this.text
		charMax=lineText.length
		lineText+=spaces
		lineWait=this.wait
		TextScroll()
	}

// getting the text into the Scroll effect
function TextScroll() 
	{
		if (charNo <= charMax) 
		{
			document.formDisplay.buttonFace.value=lineText.substring(charNo, scrollWidth+charNo)
			charNo++
			timerID=setTimeout("TextScroll()", scrollWait)
		}
	else 
		{
			charNo=0
			timerID=setTimeout("ShowNextLine()", lineWait)
		}
	}

// gee - I wonder what these functions will frickin' do?
function StartHeadliner() 
	{
		StopHeadliner()
		timerID=setTimeout("ShowNextLine()", 1000)
		timerRunning=true
	}

function StopHeadliner() 
	{
		if (timerRunning) 
		{ 
			clearTimeout(timerID)
			timerRunning=false
		}
	}

function ShowNextLine() 
	{
		(lineNo < lineMax) ? lineNo++ : lineNo=1
		lines[lineNo].Display()
	}

function GotoUrl(url)
	{
		top.location.href=url
	}