Utility functions for client-side javascript.