pro www_cme2sxt_movie, qfile=qfile, debug=debug
;+
;   Name: www_cme2sxt_movie
;
;   Purpose: map from CME -> SXT customized movie maker
;
;   Keyword Parameters:
;      qfile - WWW Post Query filename  
;  
;   History:
htemp=get_logenv('path_http')
ttemp=get_logenv('top_http')

set_logenv,'path_http','/net/diapason/www1/htdocs/solarsoft/cme'
set_logenv,'top_http','http://www.lmsal.com/solarsoft/cme

debug=keyword_set(debug)

box_message,'Runing www_cme2sxt_movie'

; --------------- read and decode the FORM input -----------
break_file,qfile,log,paths,qfil,qver,qext
;qfile=concat_dir(concat_dir(get_logenv('path_http'),'text_client'),qfil+qver+qext)
outfil=qfile + '.html'
box_message,[qfile,outfil]
qstr=url_decode(qfile=qfile)
strtext=str2cols(str_help(qstr,/nobox),':')
; --------------- -----------------------------------------

; ----------  derive HTML output document ---------------------
htmlfile=str_replace(outfil,'post','html')

mess=['www_cme2sxt_movie:  run at ' + systime(), $
      'Query File: ' + strrep_logenv(qfile,'path_http')] ;, $
;      'HTML  File: ' + strrep_logenv(htmlfile,'path_http'), $
;      'HTML  URL:  ' + http_names(htmlfile)]
; ------------------------------------------------

prstr,mess,/nomore

; ------------------ filter on everything else ------------------

  form_qstr_valid, qstr, tag, value, count, confarr=confarr
;	    merge_list='wave_len', range_list=['xcen,ewfov','ycen,nsfov']

cmes=ssw_getcme_list(string_fields='event_name',search=confarr)
help,cmes
; ---------------- generate html output -------------------
cmeyht=ssw_cme2yht(cmes,/truncate)
help,cmeyht,/str

time_window,[cmeyht.onset1,last_nelem(cmeyht.yht_time)] , $
     hour=[-3,0],t0,t1, out='ecs'

template='/net/diapason/disk2/www2/SXT/sxt_movie_cmetemp.html'
timerange=['1-Oct-1991','15-Dec-2001']

html_formtime,outfile=htmlfile,template,t0,t1,timerange=timerange,/inctime
; ----------------------------------------------------------------
box_message,['URL:',http_names(htmlfile)]

if debug then stop

set_logenv,'path_http',htemp
set_logenv,'top_http',ttemp       
return
end

