

// ************************************************************
//First, some variables you can change as you like it
// ************************************************************

// Delay in milliseconds for the typewriting headliner
typeWriterWait=120

// Delay in milliseconds for displaying the text for the blinking headliner
blinkTextWait=1000

// Delay in milliseconds for displaying nothing for the blinking headliner
blinkSpacesWait=300

// Number of times to blink
blinkMax=6

// Delay in milliseconds per character for the expanding headliner
expandWait=100

// Delay in milliseconds per character for the scrolling headliner
scrollWait=90

// Number of characters in scrolling zone for the scrolling headliner
scrollWidth=34

// Should the lines be chosen randomly (true or false)
randomLines=true

// ************************************************************
// Second, specify the lines of text
// ************************************************************

// Number of lines, specify as much as you want to use
lineMax=2
lines=new Array(lineMax)

// Define the lines as follows (text to display, url or mailto, frame name, which effect, time to wait after displaying)
// See the headliner.txt for more info on this variables
lines[1]=new Line("Новости и сообщения", "http://www.altway.ru", "", TypeWriter, 500)
lines[2]=new Line("Новости и сообщения", "http://www.altway.ru", "", TypeWriter, 1000)

// Some other variables (just do not change)
lineText=""
timerID=null
timerRunning=false
spaces=""
charNo=0
charMax=0
charMiddle=0
lineNo=0
lineWait=0

// ************************************************************
// The functions to get things going
// ************************************************************

// Define a line object
function Line(text, url, frame, type, wait) {
this.text=text
this.url=url
this.frame=frame
this.Display=type
this.wait=wait
}

// Fill a string with n chars c
function StringFill(c, n) {
var s=""
while (--n >= 0) {
s+=c
}
return s
}

// Returns a integer number between 1 and max that differs from the old one
function getNewRandomInteger(oldnumber, max)
{
var n=Math.floor(Math.random() * (max - 1) + 1)
if (n >= oldnumber) {
n++
}
return n
}

function TypeWriter() {
lineText=this.text
lineWait=this.wait
charMax=lineText.length
spaces=StringFill(" ", charMax)
TextTypeWriter()
}

function TextTypeWriter() {
if (charNo <= charMax) {
document.formDisplay.buttonFace.value=lineText.substring(0, charNo)+spaces.substring(0, charMax-charNo)
charNo++
timerID=setTimeout("TextTypeWriter()", typeWriterWait)
}
else {
charNo=0

}
}

function StartHeadliner() {
StopHeadliner()
timerID=setTimeout("ShowNextLine()", 2000)
timerRunning=true
}

function StopHeadliner() {
if (timerRunning) {
clearTimeout(timerID)
timerRunning=false
}
}

function ShowNextLine() {
if (randomLines) lineNo=getNewRandomInteger(lineNo, lineMax)
else (lineNo < lineMax) ? lineNo++ : lineNo=1
lines[lineNo].Display()
}



