Problem with thickbox and ckeditor

Problem with thickbox and ckeditor

Hello all,
 
The new version of FCKeditor is CKEditor.
I want to use this on my cms but it wont work for some reason.
 
First an explanation how my cms works.
I have a page, pages.php
via AJAX(JQuery) will a table with all the pages be loaded when page is ready.
I got a Add button above the table and a edit button for each page.
When i click Add, a thickbox will be loaded and via AJAX will the addpage.php page called.
There will be set the variables and include PageForm.tpl. This is the form for the pages.
I have in the page some input fields and a textarea that will be replaced by CKEditor.
 
When I want to edit a page, via AJAX will the editpage.php page called. There will the variables be set and then again I include the PageForm.tpl.
 
When i call the add page, thickbox will appear and form is visible. I close the thickbox and call the same button again. Again no problem.
But when i now click on Edit the form will be loaded but the CKeditor won't be visible and the textarea wont be replaced.
 
When I reload the page and call first the Edit, thickbox and form will appear without any problems, i can call a other page and the page will be set again without problems. But when I call after the Edit the Add, the CKeditor wont load. (ONLY when i reload the page again).
 
I have tried a lot "solutions" but for me it didn't work.
 
JS are included well.
 
This is what i use in the PageForm.tpl
  1.  <textarea id="content">edit!</textarea>
     <script type="text/javascript">
                    var instance = CKEDITOR.instances['content'];
                    if (instance) {
                        CKEDITOR.remove(CKEDITOR.instances['content']);
                    }
                    CKEDITOR.replace('content');
     </script>