Changed the registration of functions from global scope to local scope due namespace pollution;
Merge pull request #12 from SeriousM/namespace_issue

Changed the registration of js functions