Add jQuery and move the last bit of JS out of HTML.