requirejs compatibility fix, returning function pointer.

Fixing the require.js part.  It was not working the way requirejs expects it to, which was causing problems when trying to optimize using r.js.

This change passes define a function pointer to an anonymous function now, which acts as the factory to return an instantiation of the Mediator object instead of the Mediator object as a function.  Tested with require.js and r.js.