XPages: custom javascript disappears from the source

I’ve added some client side JS to my XPage source this way:

<script type="text/javascript"><![CDATA[



	...myjs..



]]></script>

When I switch back to “Design” tab and edit something there, sometimes this JS disappears!

I’m doing this bec I need to populate a div with HTML retrieved by Ajax when the page loads.

Please fix this bug. Also if there is a way to do this without writing JS directly to source, I’d be happy to hear about it!

I’m using 8.5.1FP2.