added docs for functions
converted to AMD to prevent window littering
Merge pull request #7 from grnadav/docs-and-amd

Docs and AMD to JS