To check if a Javascript function exists before calling it, try this:

If you want to reduce the number of strings hanging around in your code, try this instead