Are you sure the hardware in that Gateway are all working properly? Sounds like something is faulty.
Replace the IDE cables.
Try a different molex power connector on the hard drive and the optical drive. Make sure the hard drive is the only drive on the power cord from the power supply (if there are several molex connectors on the same line, the others should be left unconnected).
Try another optical drive.
Test the hard drive with the manufacturer's diagnostic utility.
Test the RAM with Memtest86+
Check the motherboard for leaking or bulging capacitors.
You might even want to try another compatible power supply.

Cricket