The University of Waterloo has provided some free legal documents for this case: "IP Assignment - Potential Collaborator" and "IP Assignment - Joint Venture". They have been crafted for Canadian law, so see a lawyer before using them in other jurisdictions.
http://wiki.velocity.uwaterloo.ca/Legal