Javascript scoping stumps me.