Change variables which we (accidentally?) in the global scope into local variables.
Merge pull request #1486 from aodn/js_variable_tidy

Change variables which we (accidentally?) in the global scope into local...