JavaScript helper functions.