Modifying JS template files so they work with require.js.

1. Changing how it uses define() - I don't think the author combined define with a prototype class properly.
2. Setting messages on the prototype instead of on the instance after it's created.