Miscellaneous JavaScript functions to be used in browser