Simple Javascript code to add formating to strings, containing variables