require.js support. resolve #72

* wrapped entire lib in a function
* detection for node.js or AMD style laoding
* global var as a fallback