;+
; Project     :	SOLAR-B - EIS
;
; Name        :	EIS_CPT_CHECK_INTERVAL
;
; Purpose     :	Checks time within one of the time intervals.
;
; Explanation :	Allows margin of error.
;
; Use         :	< res = eis_cpt_check_interval(times, starts, stops, INDEX=index >
;
; Inputs      :	times  : DBLARR[] TAI times in seconds.
;               starts : DBLARR[] TAI interval start times in seconds.
;               stops  : DBLARR[] TAI interval stop  times in seconds.
;
; Opt. Inputs : None.
;
; Outputs     : res : 1 all times within one of the intervals
;                     0 all times not in one of the intervals
;
; Opt. Outputs:	None.
;
; Keywords    : index  : LONG returns index which failed
;
; Calls       : None.
;
; Common      :	None.
;
; Restrictions:	None.
;
; Side effects:	Loses any extra dimensions of input array.
;
; Category    :	EIS_CPT.
;
; Prev. Hist. :	None.
;
; Written     :	Martin Carter RAL 10/09/05
;
; Modified    :	Version 0.0, 10/09/05, MKC
;
; Version     :	10/09/05
;-
;**********************************************************

FUNCTION eis_cpt_check_interval, times, starts, stops, INDEX=k

  FOR k = 0, N_ELEMENTS(times)-1 DO BEGIN

    dummy = WHERE(times[k] GE starts AND times[k] LE stops, count)

    IF count NE 1 THEN RETURN, 0

  ENDFOR

  RETURN, 1

END





