ajax + embeded javascripts
If you use AJAX to fetch a document which has JavaScript in it and insert it into an element on your page will the JavaScript run in the following 3 situations.
1)
if it is written into the downloaded content so that it would run if the content was accessed as its own page?
(IE a script which runs when the page is loaded)
2)
if it is written as a function and the code which executes the function is outside of the AJAX content (ie you have an event handler or a HTML element with an event parameter written into your existing page and it runs a function which is downloaded and injected into the document by the AJAX request)
3)
If the JavaScript itself is an AJAX request and it is run as ether a function or as code which runs when the page loads.
AND
if the answer to 2) is yes
what do you do about the problem of the function trigger (click, mouseover, mouseout ect) being activated before AJAX has injected the function code into the document.