;+
; Name:
;   	EIS_DATA__GETWINHEADER
;
; Purpose:
;   	Returns the FITS header for a spectral window.
;
; Calling Sequence:
;       An object of class EIS_DATA is declared with this statement: 
;                   data = obj_new('eis_data')
;
;       The header of a file can be read using its filename (full path):
;                   header=data->getwinheader(eisfile,iwin)
;
; Inputs:
;   	FILENAME: fits file name and path.
;   	IWIN: spectral window
;
; Outputs:
;   	FITS header structure. Result of adding the main extension plus 
;   	the tags relevant to each spectral window.
;
; Keywords:
;
; Example:
;   	IDL> data = obj_new('eis_data')
;   	IDL> eisfile = '$HINODE/eis/mission/2007/02/02/eis_l0_20070202_104212.fits.gz'
;   	IDL> header=data->getwinheader(eisfile,0)
;
; Modification History:
;   	2007/04/27     I.Ugarte-Urra. NRL/GMU. 
;-
function eis_data::getwinheader,filename,iwin

exten=0
header=headfits(filename,exten=exten)	;Extracting header
header=fitshead2struct(header)	    	;Converting to structure

if iwin+1 gt header.nwin then begin
    message,'Number of windows is smaller than input',/info
    return,''
endif

;;- Adding tags specific for each spectral window
hdr = self -> gethdr()
index =['TFORM','TTYPE', 'TDIM','TUNIT','TDMIN', 'TDMAX',$
	'TDESC', 'TCUNI', 'TDETX', 'TDETXW','TDETY','TDELT',$
	 'TWAVE', 'TWMIN','TWMAX','TWBND','WINHDR','CCDRON']
for i=0,n_elements(index)-1 do begin
    value=hdr->getinfo(index(i)+trim(iwin+1))
    header=add_tag(header,value,index(i))
endfor

return,header
end
