Homoclinic and chaotic transitions in the rf squid