If you hire somebody to develop a product for you, and they take the credit and the idea and make a success out of it, is it possible to have them sign a document stating that if they steal the idea, they have to sign the company over to you before you reveal the idea to them?
You are worrying about the wrong issues. Read this http://blog.foundrs.com/2009/03/11/the-great-startup-idea-that-i-cant-reveal-yet/ for a longer explanation.
The deal you suggest is about as invalid as the alleged deal between Mark Zuckerberg and the guy who asked for 1% for each day of delay on delivery of the initial code base...
If you hire a contractor to code your site, the code will be owned by you, and if the other person steals it, you can sue them and get damages (no, you can't take over their company, but damages would achieve the same result).
That is unusual, but you could put anything you want in a contract. You should do research on NDA/ Non-Disclosure Agreements. There are also confidentiality and non-compete agreements as well.
If you are serious though talk to a lawyer.