﻿var text = "content of text here";
var delay = 50;
var currentChar = 1;
var destination = "[not defined]";
var curLineIdx = -1;

var arLines = new Array("", "", "", "", "");

function type()
{
  if (document.getElementById)
  {
    var dest = document.getElementById(destination);
    
    if (dest)
    {
      dest.innerHTML=text.substr(0, currentChar);
      currentChar++
      if (currentChar > text.length)
      {
        //Get next line
        if (curLineIdx==4) 
        { 
          curLineIdx = 0;
        } else {
          curLineIdx++;
        };
        text = arLines[curLineIdx];
        if (text=='') {
          curLineIdx = 0;
          text = arLines[curLineIdx];
        };
        
        //Start over
        currentChar=1;
        setTimeout("type()", 4000);
      }
      else
      {
        setTimeout("type()", delay);
      }
    }
  }
}

function startTyping5(sLine1, sLine2, sLine3, sLine4, sLine5, iDelay, sDest)
{
  arLines[0] = sLine1;
  arLines[1] = sLine2; 
  arLines[2] = sLine3; 
  arLines[3] = sLine4; 
  arLines[4] = sLine5;
  
  delay = iDelay;
  currentChar = 1;
  destination = sDest;
  
  curLineIdx = 0;
  if (arLines[0] != '') {
    text = arLines[curLineIdx];
    type();
  };
}


