Accordian or collapsible menu question

I am trying to create a dynmic collapsible menu and I am stuck trying to load the submenu with in or under the main menu items. Here is my attempt code and source file

////////////////  VARS  ////////////////
var xPos = 20;
var yPos = 40;
var curPos = menuItem*.height;
////////////////  ARRAY  ////////////////
var menuItem:Array = new Array();
menuItem[0] = {label:"ANIMUS", link:"#"};
menuItem[0].subMenuItem = new Array();
menuItem[0].subMenuItem[0] = {label:"HISTÓRIA", link:"movies/historia.swf"};
menuItem[0].subMenuItem[1] = {label:"EQUIPE", link:"movies/equipe.swf"};
menuItem[0].subMenuItem[2] = {label:"PREMIAÇÃO", link:"movies/premiacao.swf"};
menuItem[1] = {label:"CLIENTES", link:""};
menuItem[2] = {label:"PORTIFÓLIO", link:"#"};
menuItem[2].subMenuItem = new Array();
menuItem[2].subMenuItem[0] = {label:"BRANDING", link:"movies/branding.swf"};
menuItem[2].subMenuItem[1] = {label:"EMBALAGEM", link:"movies/embalagem.swf"};
menuItem[2].subMenuItem[2] = {label:"MERCHANDISING", link:"movies/merchandising.swf"};
menuItem[2].subMenuItem[3] = {label:"AMBIENTE DE VAREJO", link:"movies/ambiente_de_varejo.swf"};
menuItem[3] = {label:"DESIGN ESTRATÉGICO", link:"movies/design_estrategico.swf"};
menuItem[4] = {label:"CONTATO", link:"movies/contato.swf"};
for (i=0; i<menuItem.length; i++) {
    attachMovie("container", "new"+i, i, {_x:xPos, _y:yPos});
    yPos += this["new"+i]._height;
    this["new"+i].label_txt.text = menuItem*.label;
    this["new"+i].url_btn._url = menuItem*.link;
    // this is were the errors start
    if (menuItem*.subMenuItem.length>=0) {
        for (j=0; j<menuItem*.subMenuItem.length; j++) {
            attachMovie("subContainer", "subNew"+j, j, {_x:xPos, _y:yPos});
            yPos += this["subNew"+j]._height;
            this["subNew"+j].subLabel_txt.text = menuItem*.subMenuItem[j].label;
            this["subNew"+j].subUrl_btn._url = menuItem*.subMenuItem[j].link;
    // this is were the errors stop 

when tested two problems happen imediatley. The menu breaks apart and only loads the values after the last submenu . Also in the output panel the submenu links are outputed before the main menu links. I have been stuck with this all day PLEASE PLEASE help me