Detect language of opened file, and include JS modes for CodeMirror as required

Fairly basic implementation so far.

Included in this pull request are changes to the way in which javascript is loaded, specifically everything now loads through requireJS and the javascript from the main page has moved to main.js.