Tree menu code problem - source file

Hi everyone, that’s my first - and not last, I hope - thread at kirupa.com.

I’ve got annoying problem with the tree menu source downloaded from:
http://www.flash-db.com/Tutorials/treemenu/index.php

I modified it as I could by myself, but there is a problem I can’t fix (I’m not very good coder, so hoping for more experienced users! :wink: ).

I’ve got a tree menu with 1st and 2nd level items. When clicking at 1st level item that has subitems on 2nd level, the 1st level item expands, is marked as active and reset all active states of the other 1st level items (and closing them if expanded). The problem is, if I don’t have any 2nd level item in each 1st level item in my menu - in conequence 1st level menu won’t expand and reset active states of the other 1st level items. So I’ve got a situation that clicking one after another 1st level items without defined subitems I have couple of items marked as active (not cleared) at the same time.

My source file is at: http://www.creativestudio.com.pl/menu.zip

Full tread at: http://www.flash-db.com/Board/index.php/topic,22625.msg86552.html#msg86552

Looking for your help. I’ve got no idea how to fix that, so if anyone could give me a hand I would be grateful.

Peter