Dynamically calling a function in a .load() snippet on IE7

Dynamically calling a function in a .load() snippet on IE7

I have a snippet of code that is brought into the DOM via a .load() call

--- snippet ---
<script type="text/javascript">

function foo()
{
  alert("foo");
}
</script>

<div> ... </div>
---

In the main html page, I attempt to dynamically call foo() via

window["foo"]();

But IE7 complains that there is no such object available. Local functions (functions defined in the main page) can be dynamically called without issue.

This works in FF 3.6x, Chrome 5.0x and IE8, but not IE7

Any suggestions for a work-around?

PS> The actual implementation is more complicated. This is the boiled down version of the problem.