Javascript script not loaded in partial (Ajax gurus... ?°

an Ajax request to my FranchiseController updates my page correctly

page.replace_html ‘table_list_item’, :partial => ‘item_franchise’
page.show ‘show_list_item’

performed correctly

in my _item_franchise partial view, I have another nested partial to
display a list of documents


<%= render :partial => ‘documents’ -%>

_documents.rhtml view is displaying correctly the list of documents as a
tree , using fairly javascript

...<%= get_tree_data(@documents, 0){|n|... and so on... </div

BUT at the end of this partial there is a <
script type=“text/javascript”>
… with some functions to be used when clicking somewhere in the tree,
like
function toggleMyTree(id) { … }

my problem is I GET A JAVASCRIPT ERROR : toggleMyTree is not defined
which happen because it seems that the script is not loaded with the
partial …
or mybe I am wrong … something else happen

any clue ?

thanks a lot for your help