title: safari problems with dom:loaded event
body: <p>I have a small problem which I can't seem to find a solution to. The problem is that the following code works in FF but doesn't in Safari. Probably it is a rookie mistake, but I have been struggling now for two days and it is really getting on my nerves.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
   var settings = functionToReadSettings();
   document.observe('dom:loaded', function () {   
    functionToInit(settings);             
   });
  &lt;/script&gt;
  </code></pre>
  
  <p>The error I get in Safari is in functionToInit. It says that settings in undefined. I tried changing the places - both the settings definition and the call to functionToInit to be in the dom:loaded and both to be outside of it, but then it doesn't work in FF also.</p>
  
  <p>Any help will be greatly appreciated.</p>
  
  <p>Edit: Here is the <code>functionToReadSettings</code> :</p>
  
  <pre><code>functionToReadSettings: function () {
   new Ajax.Request('readSettings.php', {
    method:'get',
    onSuccess: function(transport){
     settings = transport.responseText.evalJSON(true);
    }
   });
   return settings;
  }
  </code></pre>