Help with tree menu

[font=verdana, arial, helvetica][size=2]Hi,

I’m in the middle of creating a tree menu that needs to expand/collapse when items are selected. I’m drawing all my info from a DB via sendAndLoad.

I’m having alot of problems getting the “math” right for the menu tho. If you look at the attached movies (play main.swf, which loads 1.swf) and click on Villas, you’ll see what I mean. I need to have each of these items expand/collapse when they are clicked on. There will never be more then one layer under each main country, so it only has to do the expand/collapse when clicking a country.

As you’ll see it’s certainly not working properly as is. I wouldn’t normally ask for something this large, but I was wondering if someone could take a look at my source and point me in the right direction as to how what logic I should be using. I just can’t get my head around the math and logic involved to do this task.

Any help is much appreicated.[/size][/font]