on selection of a value on a drop down box a form is generated through an ajax call. the form has a date field and i have set up a popup calender for the date field. i load the javascript calender function from the onload function of the page that requests the ajax call for the form.

How can i display the calender pop up by clicking on the text?

My understanding is that the javascript which loads with onload gets killed when the ajax page is called (php) and when the ajax response comes the object is not alive to kick out the calender.

body head section (i tried putting it into a function called cal_init and calling that function after the ajax response but that doesnt work.
Code:
<script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>


<link href="SpryAssets/SpryAccordion.css" rel="stylesheet" type="text/css" />
<link href="includes/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var calendar1, calendar2, calendar3; /*must be declared in global scope*/
/*put the calendar initializations in the window's onload() method*/
window.onload = function() {
	cal_init();
	
};
cal_init()
{ alert("hi");
calendar1 = new Epoch('cal1','popup',document.getElementById('calendar1_container'),false);
	calendar2 = new Epoch('cal1','popup',document.getElementById('calendar2_container'),false);
	calendar3 = new Epoch('cal1','popup',document.getElementById('calendar3_container'),false);
};
</script>
</head>