Move JavaScript function calls out HTML