moved keypress event to document object