	SUBROUTINE SAOERAS
C
C  Note:  This is the UNIX version.
C
C       This subroutine erases the SAOimage buffer.  IFB_SAO is obtained 
C  from the COMMON block, SAOFACTS.
C			Donald H. Gudehus, August, 1993
C			Version 1U, D. Gudehus, September, 1994
C			Modified it to run under UNIX
C                       Version 2, D. Gudehus, October 1, 1994
C                       Extended code to IFB_SAO>13
C			Version 3, D. Gudehus, July 25, 2006
C			Incorporated new saofacts.for
C
	INCLUDE 'saofacts.for'
C
	IF (IFB_SAO.EQ.1) THEN
	  IBUFFER_SAO(1)='21000'O !  = 8704;  imhead.tid 512X512
	ELSE IF (IFB_SAO.EQ.2) THEN
	  IBUFFER_SAO(1)='21001'O !  = 8705;  imhead.tid 800x800
	ELSE IF (IFB_SAO.EQ.3) THEN
	  IBUFFER_SAO(1)='21002'O !  = 8706;  imhead.tid 1024x1024
	ELSE IF (IFB_SAO.EQ.4) THEN
	  IBUFFER_SAO(1)='21003'O !  = 8707;  imhead.tid 1600x1600
	ELSE IF (IFB_SAO.EQ.5) THEN
	  IBUFFER_SAO(1)='21004'O !  = 8708;  imhead.tid 2048x2048
	ELSE IF (IFB_SAO.EQ.6) THEN
	  IBUFFER_SAO(1)='21005'O !  = 8709;  imhead.tid 4096x4096
	ELSE IF (IFB_SAO.EQ.7) THEN
	  IBUFFER_SAO(1)='21006'O !  = 8710;  imhead.tid 4096x1024
	ELSE IF (IFB_SAO.EQ.8) THEN
	  IBUFFER_SAO(1)='21007'O !  = 8711;  imhead.tid 1024x4096
	ELSE IF (IFB_SAO.EQ.9) THEN
	  IBUFFER_SAO(1)='21010'O !  = 8712;  imhead.tid 1144x880
	ELSE IF (IFB_SAO.EQ.10) THEN
	  IBUFFER_SAO(1)='21011'O !  = 8713;  imhead.tid 1144x764
	ELSE IF (IFB_SAO.EQ.11) THEN
	  IBUFFER_SAO(1)='21012'O !  = 8714;  imhead.tid 128x128
	ELSE IF (IFB_SAO.EQ.12) THEN
	  IBUFFER_SAO(1)='21013'O !  = 8715;  imhead.tid 256x256
	ELSE IF (IFB_SAO.EQ.13) THEN
	  IBUFFER_SAO(1)='21014'O !  = 8716;  imhead.tid 90x90
        ELSE IF (IFB_SAO.GE.14) THEN
          IBUFFER_SAO(1)=8703+IFB_SAO
	END IF
	IBUFFER_SAO(2)=-1 !  imhead.thingct = 1 word
	IBUFFER_SAO(3)=5 !  imhead.subunit = FEEDBACK (for erasing screen)
	IBUFFER_SAO(4)=0 !  imhead.checksum
	IBUFFER_SAO(5)=IOR(0,'100000'O) !  imhead.x
	IBUFFER_SAO(6)=IOR(0,'100000'O) !  imhead.y
	IBUFFER_SAO(7)=1 !  imhead.z
	IBUFFER_SAO(8)=IOR(63,'300'O) !  imhead.t
	CALL IMTOOLCHECKSUM(IBUFFER_SAO)
	NBYTES=16
	CALL SI_WRITE(BUFFER_SAO,NBYTES)
	IBUFFER_SAO(1)=IOR(0,'100000'O)
	NBYTES=2
	CALL SI_WRITE(BUFFER_SAO,NBYTES)
C  Erase any cursors and regions left on the screen
	CALL SAO_ERASE_CURSOR(1)
C
	RETURN
	END
