I found its a problem when they do the final rendering on the templates. It tries to parse the java with in the php. Any time I try to input javascript in the template its self I get a parse error.
There is two solutions.
One would be to use this which I coded to make it easy.
https://vborg.vbsupport.ru/showthread.php?t=229347
Two would be to put the javascript in its own file and include the javascript file with in the footer.