
var text="content of text here";
var delay=50;
var currentChar=1;
var destination="[not defined]";
var step=1
var bkText=""
var bkHtml=""
var ck=1
var vLen=20

function type()
{
	if (ck == 0){ return false;}
	
  if (document.getElementById)
  {
    var dest=document.getElementById(destination);
    if (dest)// && dest.innerHTML)
    {
    	currentChar ++;
      dest.innerHTML=dest.innerHTML + text.substr(0, 1);
      text = text.substr(1, text.length-1)
      dest.innerHTML = dest.innerHTML.substr(1, dest.innerHTML.length)
      
      
      if (text.length == 0){
      		setTimeout("wait()", 5000);
      		//document.getElementById(destination).innerHTML = bkHtml
      		//text = bkText
      		ck = 0
      		currentChar=1;
      		return false;
      }
      else
      {
      		setTimeout("type()", delay);
      }
      
    }
  }
}

function startTyping(htmlParam, textParam, delayParam, destinationParam)
{
	
  text=textParam;
  bkText=textParam;
  bkHtml=htmlParam;
  vLen=bkHtml.length
  delay=delayParam;
  currentChar=1;
  destination=destinationParam;
  
  if (ck==0) {ck=1}
  if (currentChar > 1){return false;}
  if (textParam ==''){return false;}
	
  type();
}

function wait(){
	document.getElementById(destination).innerHTML = bkHtml
	text = bkText
	ck = 0
	return true;
}