Hello,

I'm a bit new to using an array so hopefully I didn't screw this up too much.

What I'd like to do is have an array in javascript create a navigation for a website I'm doing. I would like the navigation to remain somewhat dynamic so I didn't use a numeric array for that reason.

My question is, I'm trying to use a two-dimensional array (at-least that's what I think it is) which is basically the navigation menu and sub-menu. If I were to alert "nav[1].nav_title" I'll get: "Services", but what if I want to get the sub-nav to "Services"? I've tried "nav[1][1].nav_title" but it doesn't work.

Any Ideas?



//build nav
function Nav(arr_nav_title)
{
this.nav_title = arr_nav_title;
this.nav_href = Nav_href(arr_nav_title);
}



//build sub-nav
function SubNav(arr_nav_title)
{
this.nav_title = arr_nav_title;
this.nav_href = Nav_href(arr_nav_title);
}



//build nav array
var nav = new Array();

nav = [

new Nav ('Home'),

new Nav ('Services',
new SubNav ('Strategic Planning', 'Capture Planning', 'Proposal Development', 'BD Process Consulting') ),

new Nav ('About Us',
new SubNav ('Qualifications', 'Markets Supported', 'Subsidiaries') ),

new Nav ('Contact Us')

];



//create nav href
function Nav_href(title)
{
var href_lc = title.toLowerCase();
var href = href_lc.replace(/ /, '_');

return href;
}