some javascript utility functions i wrote