Added replaceKeys method

Added replace and replaceKeys functions for the "replace" parameter that I'm going to add in setText.java.

Was going to do this all in element-commands.js, but it looks like I would need to add 12 dependencies and an init function, so I thought it may be cleaner to keep it in two files. If that isn't as neat I can just move them.