JavaScript functions to manipulate Hangul text