I see. The shopping cart looks like it is expecting the output to simply be embedded in the page. I would check the support for that cart software to see if they have an alternate code (they may have something like !--SCRIPT-- for JavaScript for example) that sanitizes the code. In the meantime a possible workaround is to change the first line of the script from:
HTML Code:
var outputstr = "!--TEXT-- "
to:
HTML Code:
var outputstr = '!--TEXT--'
outputstr = outputstr.replace('"', '\\"')
Note the quotes. In the first line, you are using single quotes. In the second line you are enclosing a double quote in a single quote. I am not absolutely sure about how many backslashes you need in the second line, but worst case scenario you could use """.