<p>Is it possible in a large GWT project, load some portion of JavaScript lazy, on the fly?
   Like overlays. </p>

<p>PS: Iframes is not a solution.</p>

I think this is what you are looking for.
```
```
<body onload="onloadHandler();">
<script type="text/javascript">
function onloadHandler() {
    if (document.createElement && document.getElementsByTagName) {
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = './test.js';
        var heads = document.getElementsByTagName('head');
        if (heads && heads[0]) {
            heads[0].appendChild(script);
        }
    }
}
function iAmReady(theName) {
   if ('undefined' != typeof window[theName]) {
       window[theName]();
   }
}
function test() {
   // stuff to do when test.js loads
}        
</script>
```
```
-- test.js
```
```
iAmReady('test');
```
```
Tested and working in Firefox 2, Safari 3.1.2 for Windows, IE 6 and Opera 9.52. I assume up-level versions of those should work as well.
Note that the loading is asynchronous. If you attempt to use a function or variable in the loaded file immediately after calling
```
appendChild()
```
it will most likely fail, that is why I have included a call-back in the loaded script file that forces an initialization function to run when the script is done loading.
You could also just call an internal function at the bottom of the loaded script to do something once it has loaded.