Create "click" event using an event constructor

The way the click event was being created is deprecated. An event constructor should be used instead:
https://developer.mozilla.org/en-US/docs/Web/Guide/DOM/Events/Creating_and_triggering_events

In addition using the event constructor fixes a scrolling bug where clicking the "OK" button in the
modal caused a scroll to the top of the page.
Remove superfluous conditional clauses
Merge pull request #14 from digitalfrost/scroll-bug

Create "click" event using an event constructor