documentation audit added more API docs to state.js
state_manager.js documentation audit
Reviewed and added some more documentation. update code examples with correct syntax, semi colons and the var keyword.