Calculate number of top level nav items with js