Hard drive is failing, iMac is freezing?
Failing hard drives tend to cause freezing on your computer, as it takes longer for your Mac to read system files.  If you think your HD is failing (as it sounds), it should still be under warranty, so you should be able to get it replaced.  You can check your drive status in Disk Utility: http://docs.info.apple.com/article.html?path=DiskUtility/10.5/en/duh1896.html but this check is not always 100% accurate.