title: Executing javascript code upon the load (and inside) of a javascript Modalbox
body: <p>What i'm exactly trying to do is make my script.aculo.us Autocompleter work for my form when it is loaded inside a Modalbox object.</p>
  
  <p>Of course, i've tried my Autocompleter when loading the form as standalone and it works just as expected. For reference, here is my JS code loading the feature:</p>
  
  <pre><code>Event.observe(window, 'load', function() { 
  new Ajax.Autocompleter("gl_name", "autocomplete_choices", "&lt;? echo WEB_ROOT . $page_name; ?&gt;?action=ajax_autocomplete", {
      paramName: "value",
      minChars: 2,
      indicator: 'indicator1',
      afterUpdateElement: getSelectionIdGL
      });
  });
  </code></pre>
  
  <p>Then I have my Autocompleter div and indicator which appear at the end of my html's body:</p>
  
  <pre><code>&lt;span id="indicator1" style="display: none"&gt;
      &lt;img src="/images/spinner.gif" alt="Working..." /&gt;
  &lt;/span&gt;
  &lt;div id="autocomplete_choices" class="autocomplete"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I also called the Modalbox() with evalScripts: true.</p>
  
  <p>So I basically know where my problem is: I want my autocompleters to be created a the load of the form, but the "window" object is already loaded when the script is written since it's basically the same window as the calling page.</p>
  
  <p>That said, I honestly don't see to which event it could ever be actually triggered. I don't even know if it's actually possible, but I certainly hope it is.</p>
  
  <p>So.. that's about it. I don't know what else to add. Don't hesitate if you need any clarifications on my issue.</p>