Various JavaScript helper methods.