It looks as though your code is being encoded with the html entities. It looks like you also have the code in the script tag inside of an html comment. You should try removing the comment from the code so it is more like this:
<script type="text/javascript">
function MM_swapImage() {
// the rest of the code in here
</script>
If you continue to have problems with this post back with the exact steps you are taking that get you this result, there may be a problem with the way it is being added in.