Fixed up the tests so they run.

Added AddFunction, to the scripting extensions. AddFunction will lazily add a function to a Javasctipt object.

This should allow script libraries "namespaces" to be extended with functions.