I know that when using jQuery you can do $(\'element\').click(); to catch the click event of an HTML element, but how do you do that with plain Javascript?
Here is an interesting article about that, i used the same approach some times, basically, you add the event handler to window.
http://mislav.uniqpath.com/js/handling-events-on-elements/