You can add functions to windows that fire on the following events: