Delay timeouts in loops

JavaScript

var i = 1;                     //  set your counter to 1

function myLoop (u,n) {           //  create a loop function
   setTimeout(function () {    //  call a 3m setTimeout when the loop is called
       window.open(u,n);          //  your code here
      i++;                     //  increment the counter
      if (i < 500) {            //  number of times you want to call function
         myLoop("http://xospital.mobi/Rooms/ExamineAll?","Rooms_Examine");              //  ..  again which will trigger another 
      }                        //  ..  setTimeout()
   }, 20000)
}

//myLoop("http://www.google.com","g"); 

myLoop("http://xospital.mobi/Rooms/ExamineAll?","Rooms_Examine");