JavaScript helper methods.