fix library style based on gslint and jshintrc

A few passes of fixjsstyle, gjslint and jshint were used to clean up the codebase. Most obvious change is a forced consistent use of semicolons everywhere. There were a number of errors elicited in the process (unused variables mostly), as well as consistent coerced comparison issues (===, !==)