function NewMenuList=flipmenus(StartHandle,OrigHandles)
%FLIPMENUS Recursively flip menu child order

%   Loren Dean
%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 1.4 $ $Date: 1998/02/03 14:13:20 $
Children=findall(get(StartHandle,'Children'),'flat','Type','uimenu');
Children=Children(ismember(Children,OrigHandles));
Children=flipud(Children);
NewMenuList=[];
if ~isempty(Children),
  for cLp=1:length(Children),
    NewMenuList=[NewMenuList
                 Children(cLp)
                 flipmenus(Children(cLp),OrigHandles)
                ];
  end % for cLp
end % if ~isempty
