Added the JavaScript handling

This uses the Rhino to do local processing instead of sending it to the
sever.