adds toggle function for menu items