A handful of helpful JavaScript functions.