function rotateImage(srcArray, imgId, index, timeoutSecs) {
    if (index >= srcArray.length)
        index = 0;
    var imgTag = document.getElementById(imgId);
    imgTag.src = srcArray[index];
    window.setTimeout(function () {
        rotateImage(srcArray, imgId, index+1, timeoutSecs);
    }, timeoutSecs*1000);
}

