var lines = line.length - 1;

var nextline = 1;
var nextchar = -1;
var temp = '';
var cursor = '\\';

var mouseover = 0;
var paused = 0;
var timeout;

function animate()
{
    if (temp == line[nextline] & temp.length == line[nextline].length & nextline != lines)
    {
        nextline++;
        nextchar = -1;
        document.getElementById('ticker').innerHTML = temp;
        temp = '';
        if (!mouseover) timeout = setTimeout('nextstep()', 3000);
        paused = 1;
    }
    else if (nextline == lines & temp == line[nextline] & temp.length == line[nextline].length)
    {
        nextline = 1;
        nextchar = -1;
        document.getElementById('ticker').innerHTML = temp;
        temp = '';
        if (!mouseover) timeout = setTimeout('nextstep()', 3000);
        paused = 1;
    }
    else
    {
        nextstep();
    }
}

function nextstep()
{
    paused = 0;
    if (nextchar == -1) document.getElementById('ticker').href = '/news-' + article[nextline] + '.html';
    nextchar++;
    temp += line[nextline].charAt(nextchar);
    if (cursor == '\\') cursor = '|'; else if (cursor == '|') cursor = '/'; else if (cursor == '/') cursor = '-'; else if (cursor == '-') cursor = '\\';
    document.getElementById('ticker').innerHTML = temp + cursor;
    timeout = setTimeout('animate()', 25);
}
