I use jquery to preload the animated gif, and then insert the message with the animated gif code. It worked fine until version 4.0 of Firefox. since then only the 1st frame and the animation is frozen. (it works fine on IE and chrome)
I use:
$("<img>").attr("src",image);
And later:
$(message).insertAfter(obj); // inject animated gif and some text
[EDIT] Added jsfiddle example: http://jsfiddle.net/na2ku/35/
source share