Sometimes for a reason or another, you may need to make sure a Javascript function exists or is accessible from your code, before calling it. That can be done through the following code:

if (typeof yourFunctionName == 'function') { yourFunctionName(); }