Preloader for multiple images


I am trying to create a preloader which knows the total bytes and bytes loaded for a php file loaded in and then the images from the urls it contains.

I want one loading bar to represent all the loading that is required and for it to be reasonably accurate.

Any ideas?

thanks is advance.