more consistency with event listener
cleaned up javascript to better adhere to standards

Now using localStorage instead of cookies
Made global use explicit. o_0
Now has a clean jshint bill of health