SpaKa,
My last post may have given you the wrong impression. Actually, I wanted to do what you are doing, but didn't yet know how. I now know we can gain by looking at the javascript in the htc file. I saw one other thread reporting your error, but I don't recall a solution being posted. However, I did find a nice little routine to expand and collapse SELECTED nodes at this
thread and it works fine for my needs.
Good luck.