Javascript problems with an overlay

So I'm trying to implement the following code:

Select Country:
2    <select onchange="print_state('state',this.selectedIndex);" id="country" name = "country"></select> <br />
3    City/District/State:
4    <select name ="state" id = "state"></select>
5    <script language="javascript"<print_country("country");</script>
into an overlay that I am creating.

The problem is that when I open the overlay (by clicking on a button) the code will only select a country, but not the state. However, when I link directly to the page (via the url), the code does work.

I am thinking that there is a problem with the "onchange" in the overlay. Does anyone have any suggestions?