I wrote a script in Javascript with 2 functions.
Die first shows random pictures in an random position
This works fine

The second script has to "clear up" everthing and put everything back to the Startposition.

My script at this time:

```
function clearPics(){

    $("img[class^='mapic']").attr('src','empty100.jpg');
    $("img[class^='mapic']").attr("title",'');
    $("img[class^='mapic']").attr("alt",'');
}

    function makePics(){
// 1 Step take 5 different Pics
var MAAuswahlArr = [];
var AnzahlAnzeige = 5;
var lauf = AnzahlAnzeige
while (lauf > 0){
    var testvar = getRandomInt(0,MAArr.length-1);
    if (contains.call(MAAuswahlArr, testvar)){
    }else{
        MAAuswahlArr.push(testvar);
        lauf--;
    }
}

// 2 Step get 5 of 10 different positions 
var BildanzahlMax           = 10
var BildanzahlArr           = [];
var BildPositionenbesetzt   = 5;
lauf = BildPositionenbesetzt;
while (lauf > 0){
        var testvar = getRandomInt(0,BildanzahlMax);
        if (contains.call(BildanzahlArr, testvar)){
    }else{
        BildanzahlArr.push(testvar);
        lauf--;
    }
}   

// 3 step: take 5 Pics an put ist in the src the alt and title Tags  
  lauf = BildanzahlMax;
  while (lauf > 0){
  var className = "mapic"+lauf;
    if (contains.call(BildanzahlArr, lauf)){
        $('.'+className).attr('src',MAArr[lauf-1][2]);
        $('.'+className).attr("title",MAArr[lauf-1][1]);
        $('.'+className).attr("alt",MAArr[lauf-1][0]);
    }
  lauf--;
  }
// 4. step: make the Pics Hover
  $("img[class^='mapic']").hover(function() {
        var maName = $(this).attr("title");
        var mafunktion = $(this).attr("alt");
        $('.matextblock').html("<h3> Unser Team</h3> <p class='maName'>"+mafunktion+"</p><p class='maFunktion'>"+maName+"</p>");
        console.log('huhu rein');

    }, function() {
        $('.matextblock').html('');
    });
    return true;
    }
$(document).ready(function() {  
setInterval(function(){
   var done = makePics();
    console.log(done);  
    if (done){ 
        clearPics();
        //console.log('clear');
     }else{
        done = false;
    }
    },2000);
});

```

How can I run the script to 
a) make the Picture

b) wait 5 or n seconds

c) clear up

and go back to a) ?