JavaScript utility functions for