Some JavaScript functions for string formatting