Problem with tiny_mce

I have a problem with the tiny_mce, i have this javascript in my view
(that javacript works fine because when i didn't had tiny_mce it
worked fine):

   . <script>
   . function change(value)
   . {
   .
   . <% for layout in @layouts %>
   .
   . if (value == "<%= layout.temp_id %>")
   . {
   . document.getElementById
("text_area_html_content").innerHTML = '<%= layout.body %>';
  . }
  .
  . <% end %>
  .
  . }
  . </script>

And also I have this in the HTML

  . <%= collection_select(:temp,:temp, @templates, :id, :name ,
{:class => 'selecttag'}, :onchange => "change(value);") %>
  .
  . <%= f.text_area :body, {:id => "text_area_html_content",:class =>
'mceEditor'} %>

So...

The 'onchange' event of the select tag changes the innerHTML of the
textarea using the javascript above. When I had the text without the
tiny_mce it worked fine, but now with the tiny_mce the innerHTML it
doesn't works.

Can anyone help me, any ideas?

Thanks,

I solved the issue:

This was the the old script:

  tinyMCE.get('editor1').setContent('<h1>This is Ronen Site 1</h1>');

   . <script>
   . function change(value)
   . {
   .
   . <% for layout in @layouts %>
   .
   . if (value == "<%= layout.temp_id %>")
   . {
   . document.getElementById
("text_area_html_content").innerHTML = '<%= layout.body %>';
  . }
  .
  . <% end %>
  .
  . }
  . </script>

I changed it to:

   . <script>
   . function change(value)
   . {
   .
   . <% for layout in @layouts %>
   .
   . if (value == "<%= layout.temp_id %>")
   . {
tinyMCE.get('text_area_html_content').setContent('<%= layout.body
%>');
  . }
  .
  . <% end %>
  .
  . }
  . </script>

Hope it helps someone in the future,

Elioncho