Refs #4494: Registers elgg JS object as AMD module.
Merge pull request #523 from ewinslow/amd-support-b4494

Refs #4494: Add AMD support
Move logic to Elgg_RequireJS, added to service provider.
Fixes module loading in subdomains
Avoids fatal if no module added before foot rendered
Avoids duplicate deps