How old is your iMac? If it is a 2010 model, then you will just need an HDMI/DVI to Mini DisplayPort adapter.
If you have a 2011 model iMac, you can't use it as an external display. The new iMacs can only accept a signal from another Thunderbolt equipped device.