<script type="text/javascript">
var images = new Array(
"img/1.jpg",
"img/2.jpg",
"img/3.jpg",
...
"img/20.jpg"
);
var img = images;
for (var i = 0; i < 5; i++) {
var a = Math.floor(Math.random() * img.length);
document.write ("<div class='photo'><img src ='"+img[a]+"' /></div>");
img.splice(a,1);
};
</script>