 == 40: # down
        key[3] = to
    elif which == 32: # space bar
        key[4] = to

def stop():
    global key
    key = [0, 0, 0, 0, 0]

def move(x):
    changeKey(x, 1)
    timer.set_timeout(stop, 50)

# put "move" in Javascript namespace, for inline event callbacks
window.move = move

def key_down(e):
    if not e:
        e = win.event
    changeKey(e.keyCode, 1)
    e.preventDefault()
    e.stopPropagation()

def key_up(e):
    if not e:
        e = win.event
    changeKey(e.keyCode, 0)
    e.pre