      SUBROUTINE EQUECL( EPS, MODE, EQU, ECL )
C
C     GIVEN THE TRUE OBLIQUITY OF THE ECLIPTIC OF DATE, EPS (RADIANS),
C     AND THE POSITION AND VELOCITY OF AN OBJECT IN SPHERICAL COORDI-
C     NATES IN EITHER THE EQUATORIAL OR ECLIPTIC FRAME OF REFERENCE,
C     CONVERT TO THE OTHER FRAME.  IF MODE IS POSITIVE, CONVERT FROM
C     EQUATORIAL TO ECLIPTIC; IF MODE IS NEGATIVE, CONVERT FROM ECLIPTIC
C     TO EQUATORIAL.  THE ELEMENTS OF THE 6-VECTORS EQU AND ECL ARE:
C
C        I   EQU                    ECL
C
C        1   RA (RAD, 0 TO 2*PI)    L (RAD, 0 to 2*PI)
C        2   DEC (RAD, -PI TO +PI)  B (RAD, -PI TO +PI)
C        3   R (AU)                 R (AU)
C        4   DRA/DT (RAD/DAY)       DL/DT (RAD/DAY)
C        5   DDEC/DT (RAD/DAY)      DB/DT (RAD/DAY)
C        6   DR/DT (AU/DAY)         DR/DT (AU/DAY)
C
C
C     B. KNAPP, 1992-05-03, 1999-06-08, 2001-04-24 (i*4)
C
C
C     RCS DATA
C     
C     $Header$
C     
C     $Log$
C
C
      IMPLICIT NONE
C
C     INPUT
      REAL*8 EPS
      INTEGER*4 MODE
C
C     INPUT/OUTPUT (ONE EACH)
      REAL*8 EQU(6), ECL(6)
C
C     CONSTANTS
      INTEGER*4 TO_SPH, TO_XYZ
      PARAMETER (TO_SPH=-1, TO_XYZ=+1)
C
C     LOCAL VARIABLES
      REAL*8 CE, SE, XYZ(6), Y, DY
C
C     EXTERNALS
      EXTERNAL SPHXYZ
C     
      SE = SIN( EPS )
      CE = COS( EPS )
C
      IF ( MODE .GT. 0 ) THEN
C
C        CONVERT EQUATORIAL TO ECLIPTIC
         CALL SPHXYZ( TO_XYZ, EQU, XYZ )
         Y = XYZ(2)
         XYZ(2) =   Y*CE + XYZ(3)*SE
         XYZ(3) =  -Y*SE + XYZ(3)*CE
         DY = XYZ(5)
         XYZ(5) =  DY*CE + XYZ(6)*SE
         XYZ(6) = -DY*SE + XYZ(6)*CE
         CALL SPHXYZ( TO_SPH, ECL, XYZ )
C
      ELSE IF ( MODE .LT. 0 ) THEN
C
C        CONVERT ECLIPTIC TO EQUATORIAL
         CALL SPHXYZ( TO_XYZ, ECL, XYZ )
         Y = XYZ(2)
         XYZ(2) =   Y*CE - XYZ(3)*SE
         XYZ(3) =   Y*SE + XYZ(3)*CE
         DY = XYZ(5)
         XYZ(5) =  DY*CE - XYZ(6)*SE
         XYZ(6) =  DY*SE + XYZ(6)*CE
         CALL SPHXYZ( TO_SPH, EQU, XYZ )
C
      ENDIF
      RETURN
      END
