javascript generated menu working