I would check out
Docstoc - they tend to have really good templates for these things. My advice if you are looking to save money is find something along these lines on Docstoc then have a lawyer add to that document - will be much cheaper than drafting from scratch. I am keeping a blog on my process hiring with a developer and I created a list of contractual and legal tips
here. In my case though it was a straight pay for product agreement so not as complex. Good luck!