Adding thumbnails to kirupa's xml photogallery

i am trying to make the thumbnails in the kirupa tutorial (linked below) scroll vertical. now i have the scrolling working (it does move up and down) but for some reason when the script trys to calculate the distance to offset each picture, it goes crazy. some are twice as far apart as they should be and some are simply overlapping each other. my question is, do all of the thumbnails have to be the same size. i am doing this for an artists website, and his paintins are all different sizes.

please someone help. it would be much appreciated.

http://www.kirupa.com/developer/mx2004/thumbnails.htm