	FUNCTION ReqImgVal, Cad=cad, Comp=comp, nRois=nrois, Res=res
;	-------------------------------------------------------------
;+							17-Oct-91
;	NAME:
;		ReqImgVal
;	PURPOSE:
;		Converts user requests for specific "ImgParam" status
;		into a binary representation.
;	CALLING SEQUENCE:
;		ImgVal = ReqImgVal([Cad=cad, Comp=comp, nRois=nrois, 
;					Res=res])
;	Keyword Input:
;		cad 	if present, string val is converted to fix
;		comp	if present, string val is converted to fix
;		nRois	if present, string val is converted to fix
;		res	if present, string val is converted to fix
;	OUTPUT:
;		returned value is the sum of all requests.
;	HISTORY:
;		written 17-Oct-91, by gal
;-
;	------------------------------------------------------------	
;	ON_ERROR, 2	;force a return to caller on error

	ret = byte(0)	;define returned value

	cadvals = ['2S','1S','.5S']
	IF (KEYWORD_SET(cad)) THEN BEGIN
          cad = STRUPCASE(cad)
	  cadval = WHERE(cadvals EQ cad, nx)	;get cad #
	  IF (nx gt 0) THEN BEGIN
	    cadval = BYTE(cadval)
	    cadval = ISHFT(cadval, 6)
	    ret = ret OR cadval
	  ENDIF
	ENDIF

	compvals = ['COMP','LOW8','HI8']
	IF (KEYWORD_SET(comp)) THEN BEGIN
	  comp = STRUPCASE(comp)
	  compval = WHERE(compvals EQ comp, nx)	;get comp#
	  IF (nx gt 0) THEN BEGIN
	    compval = BYTE(compval)
	    compval = ISHFT(compval, 2)
	    ret = ret OR compval
	  ENDIF
	ENDIF

	IF (KEYWORD_SET(nrois)) THEN BEGIN
	  nrois = BYTE(nrois) - 1b
	  nrois = ISHFT(nrois, 4)
	  ret = ret OR nrois
	ENDIF

	resvals = ['1X1','2X2','4X4','FULL','HALF','QUART']
	IF (KEYWORD_SET(res)) THEN BEGIN
	  res = STRUPCASE(res)
	  resval = WHERE(resvals EQ res, nx)	;get res#
	  IF (resval(0) gt 2) THEN resval = resval - 3	;merge both ways
	  IF (nx gt 0) THEN BEGIN
	    resval = BYTE(resval)
	    ret = ret OR resval
	  ENDIF
	ENDIF

	RETURN, ret
	END

