Hello everyone,
I just found the answer to my question in a posting by Mauno Korpelainen. He explains that the solution to preclude the editor from erasing the javascript is: "to disable editor from your user profile: Click your name - Edit profile - and change "When editing text" - Use standard web forms and click update profile."
Sorry for the posting, I should have looked more carefully in the forum before sending the question out... Hope this answer may help some other users with the same issue.