ajax images loaded and template changes