Prototype and Scriptaculous
For this chat application we'll be using two popular javascript libraries: Prototype and Scriptaculous.
Prototype is a Javascript framework that aims to ease development of dynamic web applications. At the risk of being dubbed a traitor to PHP (just kidding!) it's integrated into the Ruby On Rails framework which seems to set a lot of gold standards these days. Prototype features class-based Javascript covering areas of particular interest to web developers such as an AJAX component, shortcut methods to commonly used Javascript functions, extensions to Javascript classes, and more besides.
Some of the finest documentation for Prototype 1.4.0 can be found at http://www.sergiopereira.com/articles/prototype.js.html. We will be using the current 1.5.0_rc1 version packaged with the Scriptaculous library but this excellent documentation still applies.
Scriptaculous (which is built on top of Prototype) offers visual effects. A lot of visual effects. These combination effects are not just for eye candy either. Using Scriptaculous, complex effects like sliders, drag and drop and similar features can be implemented quite easily without much effort. We won't be digging into this library very much but you can catch the example combination effects by visiting http://wiki.script.aculo.us/scriptaculous/show/CombinationEffectsDemo.
Prototype and Scriptaculous Setup
Setting up Prototype and Scriptaculous is a simple task. Download the Scriptaculous package from http://script.aculo.us/downloads and extract it to the ./public/javascript directory. Rename the package directory to "scriptaculous". Scriptaculous already includes the Prototype 1.5.0rc_1 library so we're good to go.
All we need do now is include the javascript files for both libraries in our chat application's HTML.