require.js support.

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