function mania_util_updateHelp(src,event,jhelpBox)
currentObj = get(overobj2('flat','visible','on'));
if ~isempty(currentObj)
    htmlStr = getHelpText(currentObj.Tag);
    if ~isempty(htmlStr)
        jhelpBox.setText(htmlStr);
    end
end

function formated = formatStr(name,desc)
formated = ['<html><b>' name ':</b> ' desc '</html>'];

function desc = getHelpText(tag)
switch tag
%
%       % Workflow Toggle Buttons
%
    case 'toggle_members'
        desc = formatStr('Class & Members','Opens panel to setup and review classes and it''s members');
    case 'toggle_modality'
        desc = formatStr('Data Modalities','Options here are depending on the previous setup. For instance, if a directory structure was specified, it is possible to use data extracted from the SPM.mat or find images by regular expressions<br>In any case, you will have to push <i>Apply</i> in order to load the data.');
    case 'toggle_training'
        desc = formatStr('Training Options','Opens panel to setup pattern classification algorithm and Feature Selection');
    case 'toggle_ensembles'
        desc = formatStr('Ensembles','Managing classifier ensembles. This panel becomes only active, when a classifier ensembles has been crated.');
    case 'toggle_validationOptions'
        desc = formatStr('Validation Options','In this panel you are able to define groups which are exclusivly used for training or testing. It is only active, when ''Test Groups''-Options in the Trainig Options panel is selected.');
    case 'toggle_validation'
        desc = formatStr('Validation & Results','In this panel validation can be started. It contains also results as well as a confusion matrix.');
%
%      % class members panel
%
    case {'edit_classname1','edit_classname2'}
        desc = formatStr('Select class to view','This is just for reviewing your setup. Use <i>setup</i> to change this setup');
    case 'pushbutton_editClassMembers'
        desc = formatStr('Edit Class and Members','Edit a prevouisly defined setup');
    case {'listbox_members_c1','listbox_members_c2'}
        desc = formatStr('Members of a class','This is just for reviewing your setup. Use <i>setup</i> to change this setup');
%
%       % Data Modalities Panel
%
    case 'popupmenu_imgType'
        desc = formatStr('Select Image Type','Different options to select images are available<br><ul><li><b>Beta-Images</b> as found in SPM.mat files</li><li><b>Con-Images</b> as found in SPM.mat files</li><li><b>by RegExps:</b> Find images in subfolders, specified by a Regular Expression Pattern</li></ul>');
    case 'pushbutton_regExp'
        desc = formatStr('Sepcify','Click to specify a regular expression and subfolders');
    case 'listbox_regExp'
        desc = formatStr('Image List for Regular Expression','Shows images found by a regular expression for the first subject - so that you can check, if your regular expression works...');
    case 'pushbutton_specify_spm'
        desc = formatStr('Secify SPM.mat','In the following file selection dialog the SPM.mat-file for the first subject has to be selected. For the others subjects, the programm will know the location of the SPM.mat (if the structure of the directories is the same).');
    case 'edit_spm_file'
        desc = formatStr('Selected SPM.mat file','Shows the location of the SPM.mat of the first subject, for review purposes.');
    case 'listbox_trials'
        desc = formatStr('Conditions/Contrasts','Shows the available contrasts. Please mark the desired contrast by mouse click and click <i>Apply</i> afterwards. You can also mark multiple contrasts by using <i>CTRL</i> in combination with a mouse button press!');
    case 'pushbutton_apply'
        desc = formatStr('Apply','Will load images as specified and assign them to classes and members. <br><b>If something is changed about the prevouis setup, you have to reload the data by pushing apply again!</b>');
%
%       % Training Options
%
    case 'popupmenu_validator'
        desc = formatStr('Validation Menu','Select type of validation<br><ul><li><b>Leave one out per group cross validation</b> Simple cross validation, in each iteration one subject is used for testing, the others for training</li><li><b>Leave one out per group</b> like loocv, but for testing one subject of each group will be used (pairs). Of course this option requires, that in each class is the same amount of class members.</li><li><b>Test Groups</b> provides a training with specific groups and a simple testing / computation with remaining groups. On the panel <i>validation options</i> these groups can be specified - it will be enabled, if you select this option. For instance:<ul><li>Do a simple hold out, by splitting a group in two groups, say split groups A and B in A<sub>1</sub>, A<sub>2</sub>, B<sub>1</sub> and B<sub>2</sub> then train with <sub>1</sub>-groups and test with <sub>2</sub>-groups </li><li>If you have three groups (A,B,C): Train with A and B, and test with C to find out, if group C might look very similar to A or B.</li><li>You have two groups A and B and a single subject, whos class membership is unknown. Just setup a third group C and assign the single subject to this group. Then train with A and B, test with C.</li></ul></li></ul>');
    case 'popupmenu_classifiers'
        desc = formatStr('Classifier','Select a classifier. You can edit (or have edit, depending on the classifier) the settings of the classifier using the menu edit -> classifier settings. For a detailed description of each classifier, please have a look a the documentation.');
    case 'pushbutton_fs'
        desc = formatStr('Setup Feature Selection','Opens window to setup data modifiers.');
    case 'listbox_fs'
        desc = formatStr('Selected data modifiers','These data modifiers apply in the order shown here.');
    case 'pushbutton_viewClassifierSettings'
        desc = formatStr('View Classifier Settings','Displays actual classifier settings.');
    case 'pushbutton_editClassifierSettings'
        desc = formatStr('Edit Classifier Settings','Change settings of the actual classifier.');
%
%        % Expert options
%
    case 'listbox_pre_active'
        desc = formatStr('Selected preprocessing options','These data modifiers apply before cross validation (by selected order!). Use the <i>Settings</i>-button, to configure selected data modifiers! For detailed description of the available options, please have a look at the documentation. ');
    case 'listbox_pre_inactive'
        desc = formatStr('Avaiable preprocessing options','These data modifiers apply (when selected) before cross validation. For detailed description of the available options, please have a look at the documentation.');
    case 'listbox_intra_active'
        desc = formatStr('Selected data modifier options','These data modifiers are <b>embedded</b> in the cross validation. Use the <i>Settings</i>-button, to configure selected data modifiers! For detailed description of the available options, please have a look at the documentation. ');
    case 'listbox_intra_inactive'
        desc = formatStr('Avaiable data modifier options','These data modifiers are (when selected) <b>embedded</b> in the  cross validation (by specified order!). For detailed description of the available options, please have a look at the documentation.');
    case {'pushbutton_add_intra','pushbutton_rem_intra','pushbutton_add_pre','pushbutton_rem_pre'}
        desc = formatStr('Select/Deselect modifier','slected modifiers appear on the left side, deselected on the right side.');
    case {'pushbutton_settings_pro','pushbutton_settings_pre'}
        desc = formatStr('Modifier settings','mark a slected modifier (left side) and setup it options by using the <i>Settings</i>-button.');
    case {'pushbutton_view_pro','pushbutton_view_pre'}
        desc = formatStr('View settings','mark a slected modifier (left side) and view its actual Settings.');
%
%        % Validation Panel
%
    case 'table_confusion'
        desc = formatStr('Confusion Matrix','Shows results of last validation process. <a href="http://en.wikipedia.org/wiki/Confusion_matrix">Wikipedia article</a> shows how it works.');
    case 'accGraphic'
        desc = formatStr('Accuracy rates','Visual representation of the results.');
    case 'pushbutton_validation'
        desc = formatStr('Start Validation','starts validation and presents results above afterwards');
%
%      % Ensembles
%
    case 'listbox_ensembleList'
        desc = formatStr('Classifier','Pool of generated classifiers');
    case 'listbox_ensPerf'
        desc = formatStr('Performances','List of individual computed performances for each classifier');
    case 'pushbutton_fromComputed'
        desc = formatStr('add last computed classifier','will add the actually computed classifier to the pool of classifiers');
    case 'pushbutton_addFromFile'
        desc = formatStr('add from saved classifier','load a previously saved classifier to the pool of classifiers');
    case 'pushbutton_removeFromEnsemble'
        desc = formatStr('Remove','removes the marked classifer from the pool of classifiers');
    case 'pushbutton_resetEnsemble'
        desc = formatStr('Reset','remove the pool of classifiers and start over');
    case 'pushbutton_ensembleRun'
        desc = formatStr('Majority Vote Start','Starts leave one out cross validation for all classifiers and computes a Majority Vote for each tested subject.');
%
%       % Validation Setup
%
    case 'valOpt_train'
        desc = formatStr('train','this class will be used for training only.');
    case 'valOpt_test'
        desc = formatStr('test','predicts members of this class, will not be used for training.');
%
%       % Pathchooser
%
    case {'pushbutton_rename1','pushbutton_rename2'}
        desc = formatStr('rename','rename the displayed class. For instance ''patients'' or ''healty controls''');
    case {'pulldown_c1','pulldown_c2'}
        desc = formatStr('Class pulldown menu','Switch the actual displayed class');
    case {'listbox3','listbox5'}
        desc = formatStr('class members','Each line represents one member of the selected class');
    case {'pushbutton1','pushbutton4'}
        desc = formatStr('Add','adds subject from available subjects to a specific class');
    case {'pushbutton2','pushbutton3'}
        desc = formatStr('Remove','removes subject from class and throws it back into pool of available subjects');
    case 'listbox4'
        desc = formatStr('Directory list','list of available images or direcotries respectively - which represent subjects that are not assigned to a class, yet');
    case {'edit_classCount'}
        desc = formatStr('Current number of classes','Change to the desired amount of classes. Use pulldown menus above, to switch and setup between displayed classes');
    case 'pushbuttonReset'
        desc = formatStr('Reset','Clears the complete setup and asks again for a folder to specify');
    case 'save'
        desc = formatStr('Save','save the current setup to a text-file.');
    case 'pushbutton_xls'
        desc = formatStr('Load','Load setup from a previoulsy saved setup - or a setup which was manual written in a txt-file or xls-file (format of such files can be found in the documentation.');
    case 'pushbuttonQuit'
        desc = formatStr('Cancel','cancel this dialog and leave everything unchanged.');
    case 'pushbutton5'
        desc = formatStr('Ok','apply the current setup and go back to main GUI');
%
%        % ignore
%
    case {'text_classes','slider1','text19','text18','text22','text24','text23','valOpt_string','text_members1','text_members2'}
        desc = [];
    otherwise
        desc = ['<html><font color="red">Help Description not found for this item:</font> ' tag '<br>Sorry! Feel free to report this Bug to the author.</html>'];
end