Show loading icon with custom tool using ASP.NET and ArcGIS Server
Your quickest answer, is create a DIV on your page; set it to runas server, then hide it. So when you start your function go through and turn that div on, then when finished turn the div off.
I don't have any code I can quickly post for you; but I have done this all over the place in my COTS apps and the workflow is pretty solid.