var __scrollArray;
var __pad = 10;
var __pos;
var __scrollLine = 0;
var __keyRate = 150; //ms
var __pauseOfMessage = __keyRate * 50;


function __stripHTML(t)
{
  while (t.indexOf('<') != -1)
  {
    if (t.indexOf('<') <= 1)
      t2 = "";
    else
      t2 = t.substring (0, t.indexOf('<'));
    t3 = t.substring (t.indexOf('>')+1);
    t = t2.concat(t3);
  }
  return t;
}

function __scrollMe()
{
    if (__pos > __pad)
    {
        __pos=0;
        //__scrollLine++;
        var oldscrollLine = __scrollLine;
        while (oldscrollLine == __scrollLine)
            __scrollLine = Math.floor(Math.random() * __scrollArray.length);

        if (__scrollLine >= __scrollArray.length)
            __scrollLine=0;
    }
    var text = __stripHTML(__scrollArray[__scrollLine]);
    //window.status = window.status.substring(1);
    window.status = window.status.substring(1);
    if (__pos < text.length)
		window.status = window.status.concat(text.charAt(__pos));
    else
        window.status = window.status.concat('.');

    __pos++;
    if (__pos == __pad)
        timer = setTimeout('__scrollMe()', __pauseOfMessage);
    else
        timer = setTimeout('__scrollMe()', __keyRate);
}

function scrollMeInit (data)
{
    
    window.status = "";
    __scrollArray = data;
    var j;
    for (j=0; j<__scrollArray.length;j++)
    {
        if (__pad < __stripHTML(__scrollArray[j]).length)
        __pad = __stripHTML(__scrollArray[j]).length;
    }
    __pad = __pad + 20;
    __pos = __pad;
    for (j=0;j<__pad;j++)
        window.status = window.status.concat('.');
    __scrollMe();
}
