How to set attribute when loaded ?

How to set attribute when loaded ?

Hi, i'm trying jquery, and i want do do something .. that seems i cant understand how to do. 

thats my problem : 

i've got a page with some link and a div, every link calls this function : 

  1. function ajax_page(ele,url){

  2. $(ele).load(url);
  3. setTimeout('justify()', 300);
  4. }
the justify function its made by me and resize the div with the right dimensions.

now i wanted to load some pages with inside some images that i want to be loaded with fancybox 

so i've putted this code into the $(function(){ init 

  1. $(function(){
  2. $("a#fancybox").fancybox({
  3. });
  4. }
if i simply add an image with 

  1. <a href='image.jpg' id='fancybox'><img src='thumb.jpg'></a>
works like a charm, but if i make jquery load the same code (<a href='image.jpg' id='fancybox'><img src='thumb.jpg'></a>) from an external html file, than this image wont work with fancybox. 

i think that is because this div with the image is not loaded from the beginning and so jquery cant recognise him. 

how could make it works ? , i think that i would need something that will initialize the new boxes when i load em into the div ...


(thats fancybox link  http://fancybox.net/ )