Take it to the nearest Apple Store, or authorized repair facility. Your machine probably needs a new power supply and motherboard.
Luckily, since that is the first generation iMac G5 and Apple has noticed a higher-than-normal failure on these machines, that machine probably falls under the complimentary extended warranty for power and/or video issues. That extension goes another year beyond the first year, but only for those issues.
This is moot if you bought the AppleCare Protection Plan, in which case you are covered.
Back up your data ASAP. Failures in power supplies and motherboards can also cause hard drive damage.
Good luck.