*-----------------------------------------------------------------------
*     Copyright (C) 2000-2016 GFD Dennou Club. All rights reserved.
*-----------------------------------------------------------------------
      INTEGER FUNCTION IUETON(ZLEV)

      COMMON    /UEBLK1/ TL1,TL2,IPT,NT,LASCND
      PARAMETER (MAXNT=100)
      LOGICAL   LASCND
      INTEGER   IPT(MAXNT)
      REAL      TL1(MAXNT),TL2(MAXNT)

      SAVE

      DATA      IT/ 1 /


      IF (LASCND) THEN
   10   CONTINUE
        IF (ZLEV .LT. TL1(IT) .AND. IT.GT.1) THEN
          IT = IT - 1
          GO TO 10
        ELSE IF (ZLEV .GT. TL2(IT) .AND. IT.LT.NT) THEN
          IT = IT + 1
          GO TO 10
        END IF
      ELSE
        IF (ZLEV .LT. TL1(1)) THEN
          IT = 1
        ELSE IF (ZLEV .GT. TL2(NT)) THEN
          IT = NT
        ELSE
          DO 20 IT = NT, 1, -1
            IF (TL1(IT).LE.ZLEV .AND. ZLEV.LE.TL2(IT)) GO TO 30
   20     CONTINUE
   30     CONTINUE
        ENDIF
      END IF
      IUETON = IPT(IT)

      END
