FYI, I'm gradually moving away from this up-front style of declaring variables in JS. It's recommended by jslint and it matches how variables are actually scoped in JS (i.e. they are all scoped to the function, not any inner blocks) but it detracts from readability.