All the OPT tags between {literal} and {/literal} are ignored by the template compiler. You should use them to escape your JavaScript code.
Example 2.61. Preventing JavaScript code from being parsed by OPT
<script type="text/javascript">
{literal}
function foo()
{
document.write('Sample JS function');
}
{/literal}
</script>