Just set up an interval with setInterval()
:
$.fn.emotions = function() {
currentHTML = $("body").html();
newHTML = currentHTML.replace(/:D/,"<img src='/your/image/path'/>");
$("body").html(newHTML);
};
$(function() {
waitSeconds = 5;
setInterval($.fn.emotions, waitSeconds*1000);
});
And here's the jsFiddle to let you play with it.