function get_index_ver, index
;
;+
;NAME:
;	get_index_ver
;PURPOSE:
;	To look at the index structure and return the values for
;	all ".index_version" fields.  It only looks for the field
;	one level down (ie: index.gen.index_version)
;CALLING SEQUENCE:
;	a = get_index_ver(index)
;INPUT:
;	index	- an index structure
;OUTPUT:
;	returns an integer array with the values.  It will
;	be NxM where N is the number of nested structures that
;	have the field ".index_version" (typically 2) and M is
;	the number of index structures passed.
;HISTORY:
;	Written 21-Mar-92 by M.Morrison
;-
;
m = n_elements(index)
n = n_tags(index)
;
nout = 0
out = intarr(n,m)
;
for i=0,n-1 do begin
    ii = tag_index(index(0).(i), 'index_version')
    if (ii ne -1) then begin
	out(nout, *) = index.(i).index_version
	nout = nout + 1
    end
end
;
if (nout eq 0) then begin
    message, 'The index passed does not have any "index_version" tags', /info
    message, 'Returning', /info
    return, 0
end
if (nout ne n) then out = out(0:nout-1,*)
out = reform(out)
;
return, out
end
