javascript: loading bar/wheel while loading composite image
===

i have an html page with some javascript functions
it basically does this...
i have some images with transparent background (.png), i use the z-index property to sovrappose each image to the others so that i can assemble a new image
with some buttons you can activate the javascript that makes a substitution of some images with other

maybe an example can help you to understand the situation better:
imagine a car, you have three images: glasses, wheels and body
each image has transparent background so that if you see all the images together you can see the whole car
with a button you can substitute the wheels image with another wheels image so that you can see more "version" of the same car without creating an image for every combination (i have 345 possible combinations so this is the only way)

it works very well but it's slow :(
when i have to change only one piece, the substitution happens immediately
but when i have to change many pieces with only one click, it loads the images slowly so that it's an horrible effect

what i need is a loading bar/wheel that appears over every other image and that disappears when the browser ends the loading of the composite image
i tried to search the web for a solution but i find only solutions for the loading of the whole page, but here the page doesn't change, only the inner images change

how can i resolve this problem?
thanks in advance
marco