Added javascript for open new window, close window, and window close on timeout