added variables and some functions

last commit was actually change to html file. this commit is change to
js file.