Thumbnail resolution and other photo gallery questions

I am having some problems with creating decent thumbnails and graphics. When I create the images in photoshop, they are clear but when they load into my movieclip, they seem to lose their clarity. Does anyone have any tips or ideas on what is going on? Also, any tips on making 500+ px X 500+ px images clear at 40 px X 40 px using photoshop would also be helpful.

OR

On another note, I am loading my images in using XML.
Is there code out there that would allow me to resize my images to 40 x 40 automatically when they are loaded, so that I don’t need to create a new image for each? This would help with displaying the enlarged photo at a specific size when a thumbnail is clicked as well…

Also, any ideas for how to center images in the movieclip when the images are both landscape and portrait format?

Any help is greatly appreciated…

Here is the site right now…

[color=#22229c]Photo Gallery[/color]