Hi folks, I have a bit of problem with a DHTML typerwriter script. Currently the script outputs (via innerHTML) message text from a single variable--I would like to adapt it to cycle through multiple messages from an array. Any help would be GREATLY appreciated. Here's what I've got so far:

Code:
var outputDiv = null; 
var typedPortion = ''; 
var cursorChar = ''; 
var cursorHTML = '<span class="cursorChar">@<\/span>'; 
var workHTML = ''; 
var count = 0; 
var typing = setInterval('typeText();', 20); 
var message = 'A typed message with <span class=\"foo\" style=\"color: #990000\">embedded<\/span> html.'; 
var msgLength = message.length; 

function typeText() { 

	outputDiv = document.getElementById('outputDiv'); 
	
	if (count == msgLength) { 
		clearInterval(typing); 
		return; 
	}
	
	else if (count == 0) { 
		typedPortion = ''; 
	}
	
	else { 
		typedPortion = message.substring(0, count); 
		cursorChar = message.charAt(count); 
	}

	if (/</.test(cursorChar)) { 
		var tag = message.substring(count).match(/<\/?[^>]+>/); 

		if (tag) { 
			typedPortion += tag[0]; 
			count += tag[0].length; 
		}
	}

	else { 
		workHTML = '';
		workHTML += typedPortion; 

		if (count != msgLength - 1) { 
			workHTML += cursorHTML.replace(/@/, cursorChar); 
			outputDiv.innerHTML = workHTML; 
			count++; 
		}
	}
}

window.onload = function() { 
	typeText(); 
}
Thanks a bunch!