Check the normal things first, like making sure the internal battery is working still. If nothing fixes it, you might have bad capacitors. My eMac developed this problem about a month ago where it would just start freezing and the only way to get it to work again is to hard reset it. Turns out a few of the capacitors are bulging inside, and since a lot of eMacs had this problem, we just ordered new capacitors and are going to replace them. Well, my dad is. I suck at hardware repairs 😀
Anyway, check inside the RAM area to the bottom right of the RAM slots and those two little cans on the board are capacitors. If they're leaking brown or bulging, that is definitely your problem. If you have good experience with soldering, then figure out how to take the thing apart (it's a pain in the ***, trust me) and replace them. If not, try to find someone with experience. Or buy a new board (may be VERY expensive though).
Best of luck.