change non-top-level function declaration to private variables

- ES5 strict mode dictates that function statements not at top level of a program or function are prohibited
- declare local variable functions instead of using standard function() blocks for dontGoOffScreenX and dontGoOffScreenY