OK, now i see the dynamic array in the code, you can remove the debug code I had you add now.
In the souce, I see the following:
<!--function WA_ClientSideReplace(theval,findvar,repvar) {
change that to:
<!--
function WA_ClientSideReplace(theval,findvar,repvar) {
having them on the same line is causing the function to not be declared.