JS-Frontend: Added namespaces to functions and refactored to CamelCase

Ported patch #2158 to master. This includes namespaces for frontend JS. This time I separated the CamelCase patch as I don't know wether that follows your style guidelines.