A good practice to use especially when the Javascript code gets particularly complicated is to show an alert with the caller of the current function. This can be done with the following code:
alert(“caller is ” + arguments.callee.caller.toString());