    	SUBROUTINE LAYOUT_COLOR( IPEN )
C
C  PROGRAMMER: R.S. ZHOU	MAY-1986
C
C	THIS ROUTINE CHANGES THE COLORS OF PICKED LAYOUT SEGMENTS
C	TO THAT DESIGNATED BY "IPEN".
C
    	INCLUDE 'LAYOUT.CBS'
     	LOGICAL SKIP

    	IPN = IPEN
     	IF( IPN.LT.1 .OR. IPN.GT.8 ) RETURN

    	DO  222 I = 1, NLG
    	    IS = NLS(I)
     	    SKIP = .FALSE.
     	    DO 111 J=1, NLC
     		IF( NSN(J).NE.IS ) GOTO 111
     		IF( IPN.EQ.PEN(J) .AND. NFL(J).EQ.0 ) GOTO 111
     		PEN(J) = IPN
     		IF( NFL(J).EQ.0 ) THEN
     		    CALL IFSEG_OPEN(-IS)
     		    CALL IFSEG_PIVOT(P00(1,J),P00(2,J))
     		    CALL IFSEG_OPEN( IS)
     		    CALL LAYOUT_DRAW( -J, 1 )
     		    CALL IFSEG_OPEN(0)
     		    IF(BLINK.GT.0) CALL IFSEG_BLINK(IS)
     		    GOTO 222
     		ELSE
     		    IF( .NOT.SKIP ) THEN
     			CALL IFSEG_OPEN(-IS)
     			CALL IFSEG_PIVOT(P00(1,J),P00(2,J))
     			CALL IFSEG_OPEN(IS)
     			CALL IFFILL( NFP(NFL(J)) )
     			SKIP = .TRUE.
     		    ENDIF
     		    CALL LAYOUT_DRAW( -J, 0 )
     		ENDIF
111	    CONTINUE
     	    IF( SKIP ) THEN
     		CALL IFFILL( 0 )
     		CALL IFSEG_OPEN( 0 )
     		IF( BLINK.GT.0 ) CALL IFSEG_BLINK(IS)
     	    ENDIF
222	CONTINUE

     	CALL IFINIT_DUMP

     	RETURN
    	END

