Refactored autosave in window_js.html to use jquerry for events