I think this is maybe a closure issue. the onload events don't fire until all the loops have finished, in which case i is 9 (or 10) for all of the images.
Code:
for (i=0; i<numberofpics; i++) {
img[i] = new Image();
img[i].onload = function() {
var keepi = i;
ctxsrc.drawImage(img[keepi], sourcepointer, 0, widthpic[keepi], heightcanvas);
sourcepointer=sourcepointer+widthpic[keepi];
};
img[i].src = imgsrc[i];
}
Otherwise, I would try setting the .src before assigning the onload events.