Find the depth limit for items in the parent select.
function _menu_parent_depth_limit($item) {
return MENU_MAX_DEPTH - 1 - ($item['mlid'] && $item['has_children'] ? entity_get_controller('menu_link')
->findChildrenRelativeDepth($item) : 0);
}