Let's say there are 100 images, they are specified in the array mypics-mypics.
As each image loads on the page (specified within the array mypics), this function will be called, setting the imageheight array to the height of each image.
Here's the trouble, since there are 100 images loading at various times, the onload function counter variable (x) doesn't reflect the value of "x" when the function was set, instead it returns the value of "x" at the time each onload function runs, meaning it no longer points to the appropriate image. So if x is 0 the first time and 99 the last time, it stays at 99 as each onload function fires, meaning the imageheight array only has a value for imageheight.
Is there a way I can hard code the initial value of a variable into the onload function. For example, something like: