Refactored with 100% test coverage

Hi,

This pull request implements 100% unit test coverage using mocha and istanbul, as well as JSHint conformance.  I've checked that the browser test still works in my browsers, but I don't have any old browsers or IE to check with.

I also added a Makefile that has these primary targets:

- main (default): runs jshint and tests
- test: runs tests and checks that test coverage is above thresholds (defined in Makefile).
- lint: runs jshint
- build: runs the build script