i made one more tailored to this sort of thing:
http://plugins.jquery.com/project/loading
All you need to do is:
$.loading({onAjax:true,mask:true});
That'll wire it up to ajax events automatically. There are a great many more options and features though. You can use text, arbitrary elements, apply "pulse" effects and more. Check out the demo:
http://jquery-values.googlecode.com/svn/other/loading/jquery.loading.htm