sttim = '17-sep-94'
entim = '22-sep-94'
window = -1	;window in hours to be plotted at once (-1 says just do one window)
;window = 2	;plot a 2 hour segment per page
window = 26	;plot a 26 hour segment per page
notyminmax = 0	;set y range to the window which exludes the min and max value
median_pm = 0.5	;set y range to the median value +/- "median_pm" value
qdebug = 1	;print statements
;
infil = concat_dir(getenv('MDI_CAL_INFO'), 'pr_hk_info.txt')
spawn, 'grep " A " ' + infil, list
; mnem = strtrim(strmid(list, 1, 8), 2)		;all analog mnemonics
mnem = ['m+5ip', 'm+5ae', 'm+15ae']
;
;---------------------------------------
;
sttim1 = fmt_tim(sttim)
qdone = 0
while not qdone do begin
    if (window lt 0) then entim1 = fmt_tim(entim) $
			else entim1 = fmt_tim(anytim2ints(sttim1, off=window*60*60.))

    print, 'Reading database from ', sttim1, ' to ', entim1
    hk = get_hk_info([sttim1, entim1], mnem, /nostring)

    !p.multi = [0,2,2]	;four plots to the page
    !p.psym = 3		;plot data as dots
    timerange = [sttim1, entim1]		;force plot to time range requested

    if (data_type(hk) eq 8) then if (n_elements(hk.(0).daytime) gt 1) then begin
	tits = hkplot_info(hk, /tit)
	n = n_elements(tits)
	for i=0,n-1 do begin
	    npp = (!p.multi(1) * !p.multi(2) )>1	;n plots per page
	    qnover = ((i mod npp) ne npp-1) and (i ne n-1)
	    new_hkplot, hk, timerange=timerange, yrange=yrange, codelist=i, $
                                nover=qnover, tit=tits(i), qdebug=qdebug, $
				notyminmax=notyminmax, median_pm=median_pm
	end
    end else begin
	print, 'Not enough data to plot'
    end

    sttim1 = entim1
    qdone = int2secarr(entim1, entim) ge 0
end
;
end