Initial source commit, rework for browserify & tests
Add validation, docs, etc
Get window globals properly in lib, add tests