If you don’t want the thumbnails to be distorted, you can just remove the height declaration. It would probably be even better to use divs with background images for the thumbnails…
Unfortunately there isn’t going to be any way to get the height of the preview to size automatically using my first method.
You can do it with the previews being imgs, and then showing/hiding them based on which thumb has focus:
It’s not as clean, but maybe it will work better for you.