function settimescaling
%   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 axeshandles NChan channelscaling ampscaling timescaling timewindow lowerlimit
timescaling=get(gco,'Value');
if timescaling==0
    timescaling=0.01;
end
for j=1:NChan
    if ~(((0.98-j*(0.83/channelscaling))+(0.83/channelscaling)*0.5-(0.83/NChan)*ampscaling*0.5)<lowerlimit)
        set(axeshandles(j),'position',[0.03-(1-timescaling)*(0.98/timescaling)*(timewindow*timescaling) (0.98-j*(0.83/channelscaling)+(0.83/channelscaling)*0.5-(0.83/NChan)*ampscaling*0.5) 0.98/timescaling (0.83/NChan)*ampscaling],'Color','none');
    else
        set(axeshandles(j),'position',[0.03-(1-timescaling)*(0.98/timescaling)*(timewindow*timescaling) 3 0.98/timescaling (0.83/NChan)*ampscaling],'Color','none');
    end
end
timewindowslider=findobj('tag','timewindowslider');
set(timewindowslider,'Max',0.9999/timescaling);
set(timewindowslider,'Min',0);

if get(timewindowslider,'Value')>get(timewindowslider,'Max')
    set(timewindowslider,'Value',get(timewindowslider,'Max'));
elseif get(timewindowslider,'Value')<get(timewindowslider,'Min')
    set(timewindowslider,'Value',get(timewindowslider,'Min'));
end

    
if 0.1/(1-timescaling)>1
    set(timewindowslider,'SliderStep',[0.1 1]);
else
    set(timewindowslider,'SliderStep',[0.01/(1-timescaling) 0.1/(1-timescaling)]); 
end


return
