var frame = 0;         // The frame counter: keeps track of current frame.
var rand_no = Math.floor(Math.random()*num_images);
frame = (rand_no)%num_images;             // Update the frame counter
document.random_image.src = base_image + frame + ".jpg"; // Display the current frame
