build menu on window unload