Hi, this is more of an OS problem, not an iMac problem.
I bet that something is seriously corrupted with your OS X installation, and would recommend that you back up files that are important to you, and then do the following in order:
Boot from the OS X install CD and instead of installing, click on File and Disk Utility - click on Disk first Aid and repair disk and repair permissions.
use Diskwarrior 3
and lastly if those two don't fix things, reinstall.
And, I'm moving this to the OS X forum.