var theImages = new Array(); theImages[0] = ""; theImages[1] = ""; theImages[2] = ""; theImages[3] = ""; theImages[4] = ""; theImages[5] = ""; theImages[6] = ""; theImages[7] = ""; theImages[8] = ""; theImages[9] = ""; theImages[10] = ""; theImages[11] = ""; theImages[12] = ""; theImages[13] = ""; theImages[14] = ""; theImages[15] = ""; theImages[16] = ""; theImages[17] = ""; theImages[18] = ""; theImages[19] = ""; theImages[20] = ""; theImages[21] = ""; theImages[22] = ""; theImages[23] = ""; theImages[24] = ""; theImages[25] = ""; theImages[26] = ""; theImages[27] = ""; function showImage() { document.getElementById("imageRotator").innerHTML = GenerateString(); setTimeout(showImage, 5000); } function GenerateString() { var str = ""; var p = theImages.length; for (var i = 0; i < 5; i++) { var whichQuote = Math.round(Math.random()*(p-1)); if (str.indexOf(theImages[whichQuote]) == -1) str += theImages[whichQuote]; else i = i - 1 } return str; }