w/extensions/MobileFrontend/resources/mobile.startup/PageGateway.js
/**
	 * Add child to listOfSections if the level of child is the same as the last
	 * child of listOfSections, otherwise add it to the children of the last
	 * section of listOfSections. If listOfSections is empty, just add child to it.
	 * @method
	 * @private
	 * @ignore
	 * @param {Array} listOfSections - Array of section ids
	 * @param {Object} child - Section to be added to listOfSections
	 */
Add child to listOfSections if the level of child is the same as the last
child of listOfSections, otherwise add it to the children of the last
section of listOfSections. If listOfSections is empty, just add child to it.
Add child to listOfSections if the level of child is the same as the last child of listOfSections otherwise add it to the children of the last section of listOfSections . If listOfSections is empty just add child to it .
function assignToParent( listOfSections, child ) {
		var section;
		if ( listOfSections.length === 0 ) {
			listOfSections.push( child );
		} else {
			section = listOfSections[listOfSections.length - 1];
			if ( parseInt( section.level, 10 ) === parseInt( child.level, 10 ) ) {
				listOfSections.push( child );
			} else {
				assignToParent( section.children, child );
			}
		}
	}
function assignToParent ( listOfSections , child ) { var section ; if ( listOfSections . length === 0 ) { listOfSections . push ( child ) ; } else { section = listOfSections [ listOfSections . length - 1 ] ; if ( parseInt ( section . level , 10 ) === parseInt ( child . level , 10 ) ) { listOfSections . push ( child ) ; } else { assignToParent ( section . children , child ) ; } } }
Add child to listOfSections if the level of child is the same as the last
 child of listOfSections, otherwise add it to the children of the last
 section of listOfSections.
Add child to listOfSections if the level of child is the same as the last child of listOfSections otherwise add it to the children of the last section of listOfSections .
// take a look at the last child // If the level is the same as another section in this list it is a sibling // Otherwise take a look at that sections children recursively