	FUNCTION Ck_Item, item, BCS=bcs, HXT=hxt, SXT=sxt, WBS=wbs
;	-------------------------------------------------------------
;+							10-Feb-92
;	NAME:
;		Ck_Item
;	PURPOSE:
;		Compare the "item" from the search key to a list of
;		valid "search fields" which are derived from the
;		fieldnames of the actual data-structures for the 
;		specified instrument (via keyword) and return the 
;		status of the comparison (1 =found,0 = not found).
;	CALLING SEQUENCE:
;		itemStat = Ck_Item(item, [BCS=bcs, HXT=hxt, SXT=sxt, 
;				WBS=wbs] )
;	INPUT/Keyword:
;		item	the item (or field name) decoded from the 
;			search key.
;		bcs	if present, the type of data-vector to check
;			against.
;		hxt	if present, defines the data-vector
;		sxt	if present, defines the data-vector
;		wbs	if present, defines the data-vector
;	RETURNED:
;		itemStat 	0	not found or invalid item
;					for input data-vector
;				1	found or valid item for 
;					input data-vector
;	HISTORY:
;		Written 13-AUg-91, by GAL
;		17-Oct-91, cleanup of changes made in Japan.
;		and added ImgParam.
;		To DO:this routine should check input item vs tags of 
;		the structure to be search.
;		18-Oct-91 (MDM) Added one line - see below
;		4-Feb-92 (GAL) additions for DPE search
;		10-Feb-92, added Dp_mode
;-
;	-------------------------------------------------------------
;	ON_ERROR, 2 	;force a return to caller on error

;	Define Valid Search Keys:
	bcsKeys = ['None']		
	hxtKeys = ['None']
	sxtKeys = ['AspDr','Shut','Xray','Opt','ExpMode','mbe', $
		'ObsRegion','shape_cmd','FOV_Center', 'Img_Max',   $
		'Percentd','cad','comp','nRois','res','dpe','DP_mode']
	wbsKeys = ['None']

;	sxt = ['entry_type','time','day','DP_mode','DP_rate', $
;		'pfi_fwi','periph','ExpLevMode','imgparam', $
;		'ObsRegion','seq_table','shape_cmd','FOV_Center', $
;		'img_Max','Img_Avg','Area_Avg']

;	Which Search Key to check against:
	sea_flds = ''		;MDM - need to define it else get "Variable is undefined: SEA_FLDS." below at STRUPCASE
	IF (KEYWORD_SET(bcs)) THEN sea_flds = bcskeys
	IF (KEYWORD_SET(hxt)) THEN sea_flds = hxtkeys
	IF (kEYWORD_SET(sxt)) THEN sea_flds = sxtkeys
	IF (KEYWORD_SET(wbs)) THEN sea_flds = wbskeys

;	**** Debug keywords *******
;	IF (KEYWORD_SET(bcs)) THEN print, '****Ck_Item: bcs keyword is set'
;	IF (KEYWORD_SET(hxt)) THEN print, '****Ck_Item: hxt keyword is set'
; 	IF (kEYWORD_SET(sxt)) THEN print, '****Ck_Item: sxt keyword is set'
;	IF (KEYWORD_SET(wbs)) THEN print, '****Ck_Item: wbs keyword is set'

	sea_Flds = STRUPCASE(sea_flds)
	ck_item  = STRUPCASE(item)

	itemStat = WHERE(sea_flds eq ck_item)
	IF (itemStat(0) ne -1) THEN BEGIN
	  itemStat = 1		;yes a valid match was found
	ENDIF ELSE BEGIN
	  itemStat = 0		;no match was found
	ENDELSE

	RETURN, itemStat
	END
