InDesign: Arranging items using 'bring to front'

OK, problem #2.

I’ve got an InDesgn script that gathers data from text frames and then processes the data received (this is just one script of a multi-script process). But the text frames need to be in a specific sequential order front to back that can only be detirmined by a person. I have a script that does what I want, the user clicks each box in order and the script brings it to front. But there’s a problem. For the sake of idiot proofing I’d prefer to run the script for the InDesign script pallette (all the other scripts run from there). While the script works fine when run from the AS editor, when the script is run from the script pallette InDesign basically locks up and doesn’t allow the user to click anything. I tried inserting a delay to no avail. It seems that InDesign doesn’t allow any input while a script is running. So short of having the user hit the key command for ‘bring to front’ after each click (which they tend to screw up, there are dozens of text frames.) I’m out of ideas. Suggestions welcome.
I was thinking maybe there was something that could be done with Java that would check for a mousedown event and then trigger the AS? But that’s maybe a bit sophisticated for my meager skills.

Here’s my script…

	tell application "Adobe InDesign CS2"
		tell document 1
			set doneFlag to false
			repeat while not doneFlag
				select the first text frame of page 1
				set theSelection to object reference of the selection
				repeat while theSelection is not {}
					bring to front theSelection
					--display dialog "Brought to front: " & id of theSelection
					--delay 5
						set theSelection to object reference of the selection
					on error
						set theSelection to {} --if you click on nothing that means you're done.
					end try
				end repeat
				display dialog "Done?" buttons {"No", "Yes"} default button 2
				if button returned of the result = "Yes" then
					set doneFlag to true
				end if				
			end repeat
		end tell
	end tell