Autorefresh javascript - still a couple errors but nearly working