Udpated references to document to use the global/document module. Fixed a lot of jshint errors.