In JavaScript, functions defined using function declarations are available for use above their declaration. This StackOverflow question has some examples and details (and explanations as to why the top answer is right but technically incorrect as to why): http://stackoverflow.com/questions/336859/javascript-var-functionname-function-vs-function-functionname

Because of that, the variables don't need to be below the functions.