my god I hate javascript's brainless scoping rules