function clboptColor

global Line
global ButtonBackColor

n=length(Line.Color);
if Line.LastColor.index == -1
    for i=1:n
        if get(Line.Color(i).h,'Value') == 1
            Line.LastColor.index = i;
            Line.LastColor.h     = Line.Color(i).h;
            Line.LastColor.name  = Line.Color(i).name;
            Line.LastColor.tag   = Line.Color(i).tag;
        end
    end
else
    nrActive = 0;
    for i=1:n
        if get(Line.Color(i).h,'Value') == 1
            nrActive = nrActive + 1;
        end
    end
    if nrActive == 0
        set(Line.Color(Line.LastColor.index).h,'Value',1);
    else
        for i=1:n
            if get(Line.Color(i).h,'Value') == 1 && Line.LastColor.index == i
                set(Line.Color(i).h,'Value',0);
            end
        end
        for i=1:n
            if get(Line.Color(i).h,'Value') == 1
                Line.LastColor.index = i;
                Line.LastColor.h     = Line.Color(i).h;
                Line.LastColor.name  = Line.Color(i).name;
                Line.LastColor.tag   = Line.Color(i).tag;
            end
        end
    end
end
  
if Line.LastColor.index == 9 
    set(Line.ColorMenu,'Enable','on','BackgroundColor',ButtonBackColor.on)
else
    set(Line.ColorMenu,'Enable','inactive','BackgroundColor',ButtonBackColor.inactive)
end

