move client-side javascript out of index.cgi into separate file