Added javascript menu handling. Final