function cleargrid(h,varargin)
%CLEARGRID  Clears grid lines.

%   Copyright 1986-2004 The MathWorks, Inc.
%   $Revision: 1.1.6.3 $ $Date: 2004/11/18 23:41:55 $

fig = ancestor(h.Parent,'hg.figure');

% Save current zoom mode
zoommode = zoom(fig,'getmode');

delete(h.GridLines(ishandle(h.GridLines)))
h.GridLines = [];

% Restore zoommode if necessary
if strcmpi('in',zoommode),
    zoom(fig,'on');
elseif strcmpi('out',zoommode),
    zoom(fig,'outmode');
end


% % Save current zoom mode
% zoommode = zoom(double(h.Parent),'getmode');
% 
% delete(h.GridLines(ishandle(h.GridLines)))
% h.GridLines = [];
% 
% % Restore zoommode if necessary
% if strcmpi('in',zoommode),
%     zoom(double(h.Parent),'on');
% elseif strcmpi('out',zoommode),
%     zoom(double(h.Parent),'outmode');
% end