Create reusable functions for the menu opening and closing jsavascript.