function getChildren( parent, tag ) {
  var children = [];
  if ( tag ) tag = tag.toLowerCase();
  if ( typeof parent === "string" ) {
    parent = document.getElementById( parent );
  }
  for ( var child = parent && parent.firstChild; child; child = child.nextSibling ) {
    if ( child.nodeType === 1 && (!tag || child.nodeName.toLowerCase() === tag ) children.push( child );
  }
  return children;
}
getChildren( "menu", "li" )