By default, images are sorted according to their thumbnail positions on the page (top to bottom, left to right). If you want them to be sorted according to their stacking order (as you see them in the objects gallery), you may use following tweak. Add this code to the code field in on the page or website tab of the web properties dialog.
Code:
<script type="text/javascript">function xr_thumbsort(a){};</script>