function StartAllTypewriter3() {
	log("TW3 count = -1");
	var lists = document.getElementsByTagName('div');
	count=0;
	for (var i = 0; i < lists.length; i++) {
		className=lists[i].className;
		log("class ="+className);
		if (className=="Typewriter3") {
			count++;
			id="Typewriter3_"+count;
			lists[i].id=id;
			log("ID ="+lists[i].id);
	  		new Typewriter3(id);
		}
	}
	log("TW3 count ="+count);

	function log(msg) {
		//document.getElementById("TWLOG").innerHTML = msg;
	}
}
	
		
function Typewriter3(sDivID) {
	// PROPERTIES
	this.counter = 0;
	this.text = document.getElementById(sDivID).innerHTML;
	this.speed = 100; // in milliseconds
	this.mode = 0;
	
	// METHODS
	this.next = Next;
	eval(sDivID+"_div=this");
	setInterval(sDivID+"_div.next()",this.speed);
	
	// FUNCTIONS
	function Next() {
		text=this.text;
		len=text.length;
		cntr=this.counter;
		mode=this.mode;
		nextMode="203451";
		s="";
		// mode 0 = grow left-to-right
		if (mode==0) {
			s=text.substr(0, cntr);
		// mode 1 = shrink right-to-left
		} else if (mode==1) {
			s=text.substr(0, len-cntr+2);
		// mode 2 = moving bold letter left-to-right
		} else if (mode==2) {
			c=cntr;
			s=text.substr(0, c)+"<strong>"+text.substr(c, 1)+"</strong>"+text.substr(c+1);
		// mode 3 = moving bold letter right-to-left
		} else if (mode==3) {
			c=len+1-cntr;
			s=text.substr(0, c)+"<strong>"+text.substr(c, 1)+"</strong>"+text.substr(c+1);
		// mode 4 = bold growing left-to-right
		} else if (mode==4) {
			c=cntr;
			s="<strong>"+text.substr(0, c)+"</strong>"+text.substr(c);
		// mode 5 = bold shrinking right-to-left
		} else if (mode==5) {
			c=len+1-cntr;
			s="<strong>"+text.substr(0, c)+"</strong>"+text.substr(c);
		}
		document.getElementById(sDivID).innerHTML = s;
		this.counter++;
		if (this.counter>len+1) {	// pause 1 letter
			this.counter=1;
			this.mode=nextMode.substr(mode,1);
		}
	}
}

function TypewriterOld(sName,sTarget) {
	// PROPERTIES
	this.counter = 0;
	this.name = sName;
	this.text = "";
	this.speed = 100; // in milliseconds
	this.mode = 0;
	
	// METHODS
	this.addText = AddText;
	this.next = Next;
	this.setSpeed = SetSpeed;
	this.write = Write;
	
	// FUNCTIONS
	function AddText(s) {
		this.text = s;
	}
	function Next() {
		text=this.text;
		len=text.length;
		cntr=this.counter;
		mode=this.mode;
		nextMode="203451";
		s="";
		// mode 0 = grow left-to-right
		if (mode==0) {
			s=text.substr(0, cntr);
		// mode 1 = shrink right-to-left
		} else if (mode==1) {
			s=text.substr(0, len-cntr+2);
		// mode 2 = moving bold letter left-to-right
		} else if (mode==2) {
			c=cntr;
			s=text.substr(0, c)+"<strong>"+text.substr(c, 1)+"</strong>"+text.substr(c+1);
		// mode 3 = moving bold letter right-to-left
		} else if (mode==3) {
			c=len+1-cntr;
			s=text.substr(0, c)+"<strong>"+text.substr(c, 1)+"</strong>"+text.substr(c+1);
		// mode 4 = bold growing left-to-right
		} else if (mode==4) {
			c=cntr;
			s="<strong>"+text.substr(0, c)+"</strong>"+text.substr(c);
		// mode 5 = bold shrinking right-to-left
		} else if (mode==5) {
			c=len+1-cntr;
			s="<strong>"+text.substr(0, c)+"</strong>"+text.substr(c);
		}
		document.getElementById(sTarget).innerHTML = s;
		this.counter++;
		if (this.counter>len+1) {	// pause 1 letter
			this.counter=1;
			this.mode=nextMode.substr(mode,1);
		}
	}
	function SetSpeed(iSpeed) {
		this.speed = iSpeed;
	}
	function Write() {
		setInterval(this.name+".next()",this.speed);
	}
}



