pro uvspwin, struc=struc, typwin=typwin, xwin=xwin, ywin=ywin, banner=banner
common order1, diskexp, control, generic, comment
common winkeep, lastmark, getdev_xsize, getdev_ysize 
                      
            
;6/93 if n_elements(xwin) ne 0 then struc.st2.tempwinx = xwin   $ 
;            else xwin = struc.st2.tempwinx 
;if n_elements(ywin) ne 0 then struc.st2.tempwiny = ywin $
;            else ywin = struc.st2.tempwiny 


if n_elements(xwin) eq 0 then xwin = 512
if n_elements(ywin) eq 0 then ywin = 512

;6/93 if n_elements(banner) eq 0 then banner = 'UVSP ' + struc.st6.expno
if n_elements(banner) eq 0 then banner = $
   strmid(struc.st6.expno, strpos(struc.st6.expno, struc.st6.expnu, 0)-1, 99)
    
if n_elements(typwin) eq 0 then typwin = -2    ; no type of window requested

 if typwin ge 0 and typwin ne struc.st5.areawin then begin    
 ;
 ; A window for this purpose is currently displayed, so reuse it.
 ;      Must recreate areawin each time because it will vary in size.
 ;

 wset, typwin 
 wshow, typwin 
                     
endif else begin
 ;
 ; Create a window for current purpose
 ;

 if typwin eq struc.st5.areawin then begin
    wdelete, struc.st5.areawin 
    lastmark = 1- lastmark
 endif

 winup, /free, title=banner, xsize=xwin, ysize=ywin, retain=2, $
    xpos = getdev_xsize-xwin-10, $
    ypos = (getdev_ysize-ywin) * lastmark + (lastmark * (-20) + 10)

 lastmark = 1- lastmark

; if lastmark eq 0 then lastmark=1 else lastmark=0  ; alternate
endelse

return
end