Hi all, I'm was recently following this tutorial on creating your own chat box using ajax and javascript. I decided to take it a bit further and add onto it a little but, currently I am stuck on how I would go about adding flood control and how I would convert text such as "=)" into an actual smiley icon such as... I tried adding smilies by using

happy = new Image();
happy.src = "../images/smiley2.png";
var text = $('#chatText').val();

but, that didn't work. Any help would be greatly appreciated.