var url = "/billeder/Streamers"; var pictureArray = new Array(); pictureArray[0] = "26.jpg"; pictureArray[1] = "27.jpg"; pictureArray[2] = "23.jpg"; pictureArray[3] = "22.jpg"; pictureArray[4] = "21.jpg"; pictureArray[5] = "20.jpg"; pictureArray[6] = "19.jpg"; pictureArray[7] = "18.jpg"; pictureArray[8] = "17.jpg"; pictureArray[9] = "16.jpg"; pictureArray[10] = "15.jpg"; pictureArray[11] = "14.jpg"; pictureArray[12] = "13.jpg"; pictureArray[13] = "12.jpg"; pictureArray[14] = "11.jpg"; pictureArray[15] = "10.jpg"; pictureArray[16] = "09.jpg"; pictureArray[17] = "08.jpg"; pictureArray[18] = "07.jpg"; pictureArray[19] = "06.jpg"; pictureArray[20] = "05.jpg"; pictureArray[21] = "04.jpg"; pictureArray[22] = "03.jpg"; pictureArray[23] = "02.jpg"; pictureArray[24] = "01.jpg"; pictureArray[25] = "25.jpg"; pictureArray[26] = "28.jpg"; pictureArray[27] = "29.jpg"; pictureArray[28] = "30.jpg"; pictureArray[29] = "31.jpg"; pictureArray[30] = "33.jpg"; pictureArray[31] = "32.jpg"; pictureArray[32] = "34.jpg"; pictureArray[33] = "35.jpg"; pictureArray[34] = "36.jpg"; pictureArray[35] = "37.jpg"; pictureArray[36] = "38.jpg"; pictureArray[37] = "39.jpg"; pictureArray[38] = "40.jpg"; pictureArray[39] = "41.jpg"; pictureArray[40] = "42.jpg"; pictureArray[41] = "43.jpg"; pictureArray[42] = "44.jpg"; pictureArray[43] = "45.jpg"; var imagePreloader = new Array(); function randomPicture(interval,amount) { for (i = 1; i<=pictureArray.length; i++) { var image = new Image(); image.src = url + "/"+ pictureArray[i-1]; imagePreloader[i-1] = image; } var layout = ""; for (j = 0; j < amount; j++) { var rnd = Math.round(Math.random() * (imagePreloader.length -1)); var imgSrc = imagePreloader[rnd].src; layout += "\"\""; } layout = '' + layout +'
'; document.write (layout); setInterval ("updateImage("+ amount +")", interval); } function updateImage(amount) { for (i = 0; i < amount; i++ ) { var rnd = Math.round(Math.random() * (imagePreloader.length -1)); var imgSrc = imagePreloader[rnd].src; document.getElementById('random_image'+i).src = imgSrc; } }