Change toolbar button image dynamically within javascript

I have a layout with a toolbar and multiple grids.

Some user operations cause looping through many rows of the grid and therefore take up to about 20 seconds to complete. These operations are kicked off by the following:

grdReviews.attachEvent(“onCheck”, function(rId,cInd,state){ etc. etc. }

At the start of processing the onCheck event I want to change a toolbar button image from a green light to an amber light using something like the following:

tbrSelect.setItemImage(“light”, “amber-light.gif”);
… lots of javascript code …
tbrSelect.setItemImage(“light”, “green-light.gif”);

The problem is that the toolbar image isn’t being ‘refreshed’ while the code is running.

If I put an alert within the javascript then the image changes when it hits the alert.

How can I get the image to refresh within the javascript?

Regards

Roger Way

Please provide the sample where we could reproduce the problem