Topic: Javascript not executed in partial template

My webapp utilizes dhtml windows which use partial templates for their content. I have a helper file that generates the javascript necessary to create these windows, render the partial template and insert it into the content div of the window. In a previous incarnation of this implementation I did not have any problems but I recently ported the app to the prototype windows javascript library and now I am running into a strange problem. Javascript tags within my partial templates never get executed. Here is some example code to illustrate my problem:

First the user clicks on an ajax link that executes an rjs template containing something like:

<code>
page << show_js_window("search_vendor_win", "search_vendor", {:title => "Vendor Search", :width => 750, :height => 450})
</code>

"search_vendor" is the name of the partial template to be rendered inside of the window. The helper code is as follows:

<code>
        options = winopts.merge({:className => session[:theme], :resizable => true, :maximizable => false, :minimizable => false})
    content = (render(:partial => template)).gsub(/\n/, "\\\n").gsub(/"/, %q!\\\"!)
    function = 'if (mutex_window("' + winid + '")){'
    function << '    var win = new Window("'+ winid + '", ' + params_for_javascript(options) + ');'
    function << '    win.getContent().innerHTML = "' + content + '";'
    function << '    win.setDestroyOnClose();'
    function << '    win.showCenter();'
    function << '}'
    function
</code>

And the template looks something like this.

<code>
        ...snipped for clarity
    <script type="text/javascript">
        alert("Start of js block");
        function kick_input()
        {
            $('vendor_search_input').onchange();
        }
        alert("Preparing vendor list");

        var vendors = new Array(<%= @vendors.size %>);

        <% @vendors.each_with_index do |vendor, index| %>
            vendors[<%= index %>] = "<%= vendor.name %>";
        <% end %>
        alert("Created vendor list");
        new Autocompleter.Local('vendor_search_input', 'vendor_completion_list', vendors, {fullSearch: true, frequency: 0, minChars: 1, afterUpdateElement: kick_input});
        alert("Created autocompleter");
    </script>
</div>
</code>

This javascript block never executes. I never see the alerts and my autocompleter never functions. I know that the code works because it used to work and I have not changed it.

How can I make sure that the javascript gets executed either when the template is rendered or when it is included in my dhtml window?

Re: Javascript not executed in partial template

Nevermind I resolved my own issue. I replaced:

<code>
function << '    win.getContent().innerHTML = "' + content + '";'
</code>

with

<code>
function << '    new Insertion.Top(win.getContent().id, "' + content + '");'
</code>

I guess the prototype lib does something to ensure javascript tags are evaluated.