function Typewriter(sName)
{	// PROPERTIES
	this.counter = 0;
	this.name = sName;
	this.text = "";
	this.speed = 50; // in milliseconds
	
	// METHODS
	this.addText = AddText;
	this.next = Next;
	this.setSpeed = SetSpeed;
	this.write = Write;
	
	// FUNCTIONS
	function AddText(s)
	{	this.text = s
	}
	function Next()
	{	document.getElementById('typewriter_output').innerHTML = this.text.substr(0, this.counter++);
	}
	function SetSpeed(iSpeed)
	{	this.speed = iSpeed;
	}
	function Write()
	{	setInterval(this.name+".next()",this.speed);
	}
}
 
