change global vars (from input fields) into local vars. global vars caused input fields to keep their values
js code placed separately with the html page