	function msxpar, headers, parameter

;+
; NAME:
; 	MSXPAR
;
; PURPOSE:
; 	Obtain the values of a parameter in multiple FITS headers
;
; CATEGORY:
; 	Input/Output
;
; CALLING SEQUENCE:
; 	value = msxpar(headers, parameter)
;
; INPUTS:
; 	Headers: two-dimensional string array containing headers of several FITS files.
; 	The first dimension is the number of lines in a header, and the second is the
; 	number of files.
;
; 	Parameter: String name of the parameter to return, e.g. 'TIME-OBS'.
;
; OPTIONAL INPUT PARAMETERS:
; 	None
;
; KEYWORD PARAMETERS:
; 	None
;
; OUTPUTS:
; 	Array containing values of the specified keyword parameter in all files.
;
; COMMON BLOCKS:
; 	None.
;
; SIDE EFFECTS:
; 	None.
;
; RESTRICTIONS:
; 	None.
;
; PROCEDURE:
; 	Function SXPAR is repetitively applied to all the headers.
;
; MODIFICATION HISTORY:
;
;	ISTP SD RAS, Mar, 2000.
;	Victor Grechnev (grechnev@iszf.irk.ru): Initially written.
;
;	ISTP SD RAS, Jul, 2002.
;	Natalia Meshalkina (nata@iszf.irk.ru): Help added.
;
;	ISTP SD RAS, Mar, 2003.
;	VG : Fixed bug if the number of files equals 1.
;
;
;-

Sz = size(headers)

if Sz[0] eq 1 then N = 1 else N = Sz[Sz[0]] > 1

par = sxpar(headers[*,0], parameter)

Szpar = size(par)

if N gt 1 then par = make_array(N, type = Szpar[Szpar[0]+1]) else return, par

for j = 0, N-1 do par[j] = sxpar(headers[*,j], parameter)

return, par

	end
