Ben & Dion picked up my problems with the “A” in AJAX, and got some good comments. I especially like the closure idea.
Another thing I found useful (since I'm locking the UI) is the following:
document.getElementById('tree').style.cursor = 'wait'; .... .... document.getElementById('tree').style.cursor = 'auto';
That sets the cursor the the hourglass cursor, and then back to the normal cursor (works on Firefox & IE).