Folders won't "fold" properly

I’ve been tweaking some of the code in senocular’s XML tutorial (http://www.kirupa.com/web/xml/examples/mx04ASclasses.htm) on Kirupas site to use the folder system for organising music. The thing is, senocular’s tutorial starts out with all folders “open”, and I’ve been trying to tweak so that the folders start out being completely “collapsed” (like a typical explorer window), but I just can’t get it to work. The folders may start out collapsed but will not display correctly when you open them etc etc. If anyone has any ideas please take a look at the tutorial and give me a hint?