AMD Support

This turned out quite nice after all. Some inconsistencies in the wrappers between the modules were cleaned up. It is also trivial now to add support for more environments.

I have tested in browser using the 'common' tests.
Also tested on nodejs using some of the modules I am using.

Not all modules I converted were tested, but should be ok.
Please test and let me know if there are any issues. I would be happy to fix.