I've fiddled around with various stuff in the past, I would recommend against getting a webcam type camera for serious security stuff and stick to a propert CCTV hooked up to a bt848 type card. You can get single, quad and 16 input cards from Hong Kong (on ebay) for very little money.
The best place I have seen for CCTV is Henry's:
www.henrys.co.ukThey also have a nice London shop where you can see any camera hooked up.
I never found any good free software and I think I ended up using webcam32 which I used for a webcam when I was at Uni five years ago. You can set it to detect movement and it can email images, FTP files or serve JPEGs (inc. streams).
It seems that since I got my version it has been sold on and the trial version is time-limited, but it's worth a look:
http://www.surveyor.com/index_webcam32.htmlGareth