	subroutine find_onset(j0,j1,cf,jj)
c
c ...... find maximum onset time probability
c ...... stolen from Bob
c
      parameter (npoints = 10000)
c
	real*4 cf(*), p(npoints)
	integer*4 j0,jj,j1
c
	k=0
	do i=j0,j1
	  k=k+1
	  f=cf(j1)-cf(i)
	  fp=cf(i+1)-cf(i-1)
	  fpp=cf(i+1)-2.d0*cf(i)+cf(i-1)
	  p(k)=f*fp*fpp
      end do
	pmax=p(1)
	if(k.lt.2) then
	  jj=j0
	else
	  jj=j0
	  do i=2, k
          if (p(i) .gt. pmax) then
	      pmax=p(i)
	      jj=j0+i-1
	    endif
        end do
	endif
c
	return
	end
