Gallery Thumbnails change random

i have a thumbnail strip made randomly. and i want the thumnails to change in fade also randomly. my problem is that the thumbnail changes before the fade.
i created a function for each thumbnail like this:

function pic0() {
 i = random(j);
 this.createEmptyMovieClip("targetClip0", 1);
 targetClip0._x = 22;
 targetClip0._y = 13;
 this.targetClip0.attachMovie("pic"+i, "pic", 1);
}

my fadeout function is called from a clip that runs as a timer and goes to a random frame in the timer where i have a function that sends a parameter to the fadeout function that looks like this:

function fadeOut(param) {
 this.onEnterFrame = function() {
  if (_root["targetClip"+param]._alpha>0) {
   _root["targetClip"+param]._alpha -= 10;
  }
 };
 _root["picB"+param]();
}

the **_root"picB"+param;**is suppose to create the thumbnail that is suppose to exchange the first one.
which looks like this:

function picB0() {
 
 i = random(j);
 this.createEmptyMovieClip("targetClipB0", 6);
 targetClipB0._x = 32;
 targetClipB0._y = 23;
 this.targetClipB0.attachMovie("pic"+i, "pic", 6);
 fadeIn(0);
 }

my fadeIn function looks like this:

unction fadeIn(param) {
 
 this.onEnterFrame = function() {
  if (_root["targetClipB"+param]._alpha<100) {
   _root["targetClipB"+param]._alpha += 5;
  }
 };
_root["pic"+param]();
}

what this does is show me the targetClipB all the time and i know this is a long question but maybe some one can help me?