DEVELOPER-899 optimise JS load order

* split up scripts.js in to finer grained modules
* document dependencies of each module
* move AJAX calls before DOM ready event