Repair onunload event to warn user if they have unsaved changes.