I should have read the rest of your code, looks like the loop init should actually read
Code:
for (var i = 0; i < numImages; i++){
images[i]='<a href="'+path+filename+'.wmv"</a><imgsrc="'+path+filename+'.jpg">'
document.getElementById('pictures').innerHTML=images;
filename++;
}