JSHint and JSLint

I've applied JSLint and JSHint to the code, and tried where possible/reasonable to opt-out of their rules that didn't fit the style you're already using.  I also broke up the changes into very granular commits, so you can pick which ones you care about incorporating and which you aren't going to care about.  

I applied JSHint first, since it's less strict, and then applied the few things that JSLint suggested that seemed to make sense (and added opt-out directives where they were mostly noise/style-related).

I figure it'd be good to at least indicate that you've evaluated the options and chosen not to enforce them.  

Hope it's helpful.