function setgeneralcolor
%   This software is protected by german copyright and international treaties.             
%   Copyright 2004 Markus Junghöfer & Peter Peyk. All Rights Reserved.                     
%                                                                                          
%   THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE        
%   NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,    
%   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE    
%   OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
%   TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT,       
%   INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE      
%   OR DOCUMENTATION.                                                                      
global generalcolor
if strcmp(get(gco,'style'),'popupmenu')
    
	if get(gco,'Value')==1
        generalcolor = [0 0 1];
	elseif get(gco,'Value')==2
        generalcolor = [1 0 0];
	elseif get(gco,'Value')==3
        generalcolor = [0 1 0];    
	elseif get(gco,'Value')==4
        generalcolor = [0 0 0];
	elseif get(gco,'Value')==5
        generalcolor = [1 1 0];
	elseif get(gco,'Value')==6
        generalcolor = [1 0 1];
	elseif get(gco,'Value')==7
        generalcolor = [0 1 1];
	elseif get(gco,'Value')==8
        set(gco,'Style','edit');
        set(gco,'String','');
        return
    end
        
elseif strcmp(get(gco,'style'),'edit') 
    if ~isempty(get(gco,'String'))
        
        generalcolor=str2num(get(gco,'String'));
        if size(generalcolor,1)==1 & size(generalcolor,2)==1 & generalcolor == 0
            set(gco,'style','popupmenu');
            set(gco,'string',{'blue';'red';'green';'black';'yellow';'purple';'turquoise';'custom';'group'});
            set(gco,'Value',4);
            generalcolor = [0 0 0];
            return
        elseif size(generalcolor,1)~=1 | size(generalcolor,2)~=3
            uiwait(errordlg('Generalcolor nicht erkannt! Verwende Standardfarbe!'));
            generalcolor=[0 0 0];
        end
	else
        generalcolor=[0 0 0];
        set(gco,'style','popupmenu');
        set(gco,'string',{'blue';'red';'green';'black';'yellow';'purple';'turquoise';'custom';'group'});
        set(gco,'Value',4);
        return
	end  
end

return
    