Oh, and it looks like this is an IE6 issue - it runs in under 50ms with FF2.
Decided to give up on it, as it's only for relatively minor functionality.
(But feel free to still make suggestions if you really want)
i sometimes make something trivial work, and realise i should have come to this conclusion several hours earlier!
Lose the for loop and program each iteration manually?
Which one?
The outer one is required to identify the stylesheet, and the position might change as different sheets are added/removed, so it can't be fixed.
Likewise, the inner loop is required to identify the declaration, which again is not necessarily in a fixed position.