function mpcCSHelp(varargin)
%  MPCCSHELP  Display MPC context sensitive help
%
%  Threecalling formats:
%  
%  mpcCSHelp(eventSrc, eventData, Tag) (for event callbacks)
%
%  mpcCSHelp(eventSrc, eventData, Tag, Parent) (for callbacks from a modal
%  diagram with handle Parent)
%
%  mpcCSHelp(Tag)  (for standalone use with CSH viewer)
%
%  mpcCSHelp(Tag, 'HelpBrowser')  (for standalone use with help browser)
%
%  Tag must be a string defined in the mpctool.map file.

%  Author:  Larry Ricker
%  Copyright 1986-2007 The MathWorks, Inc. 

Parent = [];
WinType = 'CSHelpWindow';
switch nargin
    case 1
        Tag = varargin{1};
    case 2
        Tag = varargin{1};
        WinType = varargin{2};
    case 3
        Tag = varargin{3};
    case 4
        Tag = varargin{3};
        Parent = varargin{4};
end
if ischar(Tag) && ~isempty(Tag)
    if isempty(Parent)
        helpview([docroot, '/toolbox/mpc/mpctool.map'], Tag, WinType);
    else
        helpview([docroot, '/toolbox/mpc/mpctool.map'], Tag, WinType, Parent);
    end
end
