I usually use simple div and some javascript to do such things.
So, for example, on your page, create a div that will function as your gray.
<div id="blackout" style='background-image:url(someSemiTransparent.png); display:none;"></div>
Then create it like this:
#blackout { width:100%; height:100%; position: absolute; left:0; top:0; z-index:10 }
Then, when your process is about to begin, you can call (to show it):
document.getElementById('blackout').style.display = 'block';
And after its completion, you can hide it again:
document.getElementById('blackout').style.display = 'none';
If you show it, you can set your body overflow to hidden , and then return to auto too, this will prevent the user from scrolling and only viewing partial dimming.
Now I usually use jquery for show and hide , although I'm sure javascript more accurate.
Update:
For everything to be much more neat, as Chad mentions, you'd better put all the styles in CSS. I.E.
#blackout { width:100%; height:100%; position: absolute; left:0; top:0; z-index:10 background-image:url(someSemiTransparent.png); display:none;}
and remove the style from the div . I.e
<div id="blackout"></div>