Are you using any javascript libraries, such as jQuery? In any of the libraries, I'd imagine there'd be a dozen or so lightbox plugins floating about. Even if you don't want to use a library, you can take a look at their code, and instead of displaying a DIV, just display your gif, if you know what I mean.
There are even some plugins built specifically for this purpose, such as the BlockUI plugin for jQuery.
The basic algorithm for doing what you want goes like this:
- Start Ajax Request
- Display semi-transparent dark image over the whole page, with an animated gif in the middle.
- Listen for Ajax response
- Remove the overlay and loader gif.
I assume you already have steps 1 and 3 going alright. Step 4 is easy-peasy. Step 2 however isn't as easy, but still shouldn't be too hard. I couldn't tell you the code to do it myself, since I've just used lightbox plugins in the past. Take a look on Google for "simple lightbox" or something like that, since all you really want is the most basic functionality. This blog post talks about a CSS-only lightbox which would be a good starting point to help you style the overlay.