I have the wireless bluetooth connecting keyboard for the iMac and it continues to disconnect even when the batteries are brand new. Is there anyway to enhance the bluetooth connection so that it will stop disconnecting?
I guess you are using the original Apple keyboard? In this case, you shouldn't have any problems with the bluetooth connections when the keyboard is in front of the iMac (and your Mac is located in a "normal" office, without lots of over the air devices that can cause a lot of noise).
To me, this sounds like a hardware defect. I would take the keyboard back to Apple/reseller to get a new one.