improve the jshintrc
fix a lot of jshint warnings
fix some more jshint errors
define jshint globals in the jshintrc and fix some more errors