Another fading question

Hi again,
I have another fading question, following form my last post.
I have a series of images, that I want to fade between. So first image fades in stays for while then fades out and second image fades in, and so on.
I wanted to use script and not timeline, so I have
[AS]
marine_mc._alpha = 0;
prop_mc._alpha = 0;
re_mc._alpha = 0;
var i = 0;
var delay = 4000;
var num = 10;
img = [marine_mc, prop_mc, re_mc];
fadeIn(img*, 10);
function fadeIn(target, num) {
target.onEnterFrame = function() {
target._alpha += num;
if (target._alpha>=100) {
target._alpha = 100;
delete this.onEnterFrame;
timeDelay = setInterval(out, delay);
}
};
}
function fadeOut(target, num) {
target.onEnterFrame = function() {
target._alpha -= num;
if (target._alpha<=0) {
target._alpha = 0;
this.onEnterFrame = null;
clearInterval(timeDelay);
if (i>=img.length) {
fadeIn(img[0], 10);
} else {
fadeIn(img[++i], 10);
}
}
};
}
function out() {
fadeOut(img*, 10);
}
[/AS]

This workds fine, but I need it to loop back to the first image and start again, so it will be a looping ani.
Any Help ?