C****************************************************************
C* 								*
C*								*
C*	DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY *
C*	EITHER FOR THE CREATION OR FOR THE CLINICAL EFFICACY	*
C*	OF THIS PROGRAM. USERS MUST ASSUME FULL RESPONSIBILITY	*
C*	FOR ANY RESULTS OR DIAGNOSES OBTAINED FROM THE USE	*
C*	OF THIS PROGRAM. QUESTIONS ON THE EXECUTION OF THIS	*
C*	PROGRAM MUST BE REFERRED BACK TO THE ORIGINAL AUTHOR.	*
C*								*
C* AUTHOR:	SALLY FORSTER					*
C*		C/O DEPARTMENT OF NUCLEAR MEDICINE		*
C*		GUY'S HOSPITAL				*
C*		LONDON, ENGLAND					*
C*								*
C*		TEL: 01-407-7600 EXT 2583/4			*
C*								*
C****************************************************************
	FUNCTION SMOOTH(IP)
C*****SMOOTHS THE CURVE AND THEN REDISPLAYS IT
C*****UPTO NINE POINT WEIGHTINGS CAN BE GIVEN AS PARAMETERS
	IMPLICIT LOGICAL*1(A)
	IMPLICIT INTEGER*2(D-Z)
	COMMON//SAVDES(256),CURVE1(512),CURVE2(512)
	DIMENSION COEF(9)
	IF(IP.GT.9.OR.IP.LT.3)GOTO 200
	CD=0
	DO 10 I=1,IP
	II=I
	COEF(I)=CREPAR(II)
10	CD=COEF(I)+CD
	IX=INT(FLOAT(IP-1)/2)
	IF(SAVDES(108)-IX.LT.IX+1)GOTO 200
	DO 15 I=1,IX
15	CURVE2(I)=CURVE1(I)
	DO 25 J=1+IX,SAVDES(108)-IX
	CURVE2(J)=0
	DO 20 I=1,IP
20	CURVE2(J)=CURVE2(J)+CURVE1(J-IX+I-1)*COEF(I)
	CURVE2(J)=CURVE2(J)/CD
25	CURVE1(J-IX)=CURVE2(J-IX)
	J=SAVDES(108)-IX+1
	DO 30 I=1,IX
30	CURVE1(J-I)=CURVE2(J-I)
	SMOOTH=0
	RETURN
200	SMOOTH=-1
	RETURN
	END
