There is nothing to debug syntax wise, but logically, this:
for (i=0;i<pictures.length;i++){
document.getElementById("img1" ).src=pictures[i];
}
will loop thru all the 3 pictures and end with the last picture that you will always see.
You have to rewrite you code.
You have to understand what you are doing, don't just copy and paste.