      MODULE BLKOUT
      ALLOCATABLE XOUTL(:),YOUTL(:)
      INTEGER NOUTLIN
      ENDMODULE
    
      SUBROUTINE RDOUTLIN
!
!   ROUTINE TO READ COORDINATES OF MESH OUTLINE    
    
      USE WINTERACTER
      USE BLKOUT

      CHARACTER(LEN=255)  :: FNAME
!      CHARACTER(LEN=3)    :: SUB,SUB1
      CHARACTER(LEN=256)  :: FILTER
      CHARACTER*3 SUB
      
      FILTER ="Outline files -- *.txt|*.txt|map files -- |*.map|All files -- |*.*|"      
      CALL WSelectFile(FILTER,PromptOn,FNAME,'Load Outline File')

      IF (WInfoDialog(ExitButtonCommon).EQ.CommonOpen) THEN

         OPEN(99,FILE=FNAME,STATUS='OLD')
         CALL IlowerCase(FNAME)
         CALL GETSUB(FNAME,SUB)

         IF(SUB .EQ. 'map') then
           KTYP=2
         ELSE
           KTYP=1
         ENDIF
      ELSE
        RETURN
      ENDIF

      ALLOCATE (XOUTL(5000),YOUTL(5000))
      IF(KTYP .EQ. 2) READ(99,*) INDM
      DO N=1,5000
        READ(99,*,END=500,ERR=500) XOUTL(N),YOUTL(N)
      ENDDO
      close(99)
500   CONTINUE
      NOUTLIN=N-1
      RETURN
    END
    
