Scoped helper functions

- Moved extend, addEvent, setStyles, and destroy out of window.

- Favored use of "unless" over "if not"

- When starting from offline state, going online used to raise an error
when calling destroy. Fixed by checking if element has a parent (in
other words, was the modal appended to body).

- Adjusted copy to be slightly more succinct

- Used CoffeeScript 1.6.x over 1.4.x