factored out javascript for goals.html