There is something like doggy senility called canine cognitive dysfunction syndrome. There is a medication called Anipryl that helps some dogs. (Click and scroll down to Cognitive, the anchor link is not working for some reason.)
http://www.srdogs.com/Pages/care.cd.html#Cognitive Dysfunction
I would put her in diapers with a tail hole for the stools to drop out. Stools on the carpet are not a big problem if they are dry and well formed. As long as she is not circling and pacing through them, you can pick up after her and hopefully not need carpet spray. If you are not happy with her current stool quality, I've had the best luck with Science Diet w/d dry kibble for good stools for my incontinent dogs. Kleenex pickup and no spots on the rug. It is very important for a female dog that the stools should not collect in the diaper, they need to drop out or you risk a urinary infection.
But if she is piddling on the carpet, I would recommend diapers, too. They make doggy diapers or you can buy the human disposable diapers and cut a hole for the tail. Even if she is a big dog, they make baby diapers for up to 125 lbs (!) and then there are adult diapers. It may be cheaper to just get her some female hot pants and put a Poise pad in. Depending on the size of the dog, you may be able to cut the pads into halves or even thirds. This link shows some disposable diapers, as well as denim hot pants similar to what my dog wears. The denim diapers have really good velcro on the waist and wear like, well, denim.
I've seen some in PetsMart that are a knit fabric. I'm not sure those would work as well, I would think you want something firmer to put the pad into. With the denim you can get a nice snug fit. If you get the denim diapers or similar, you want at least 2, one to wash and one to wear.
http://www.handicappedpets.com/keep-pets-dry
My dog who wears a diaper sleeps at night bare bottom so her skin can breathe. For that you will want a way to contain your dog, either in a crate or maybe a bathroom or the laundry room or someplace where she has a blanket to sleep on but cannot hurt the floors. You end up doing a load of doggy laundry every couple of days but it's no big deal.
I would also strongly recommend baby gates so you can contain her in a part of the house that is easy to clean, or at least so you only have a couple of rooms to clean. This saves you a lot of time and you feel like you have things under control better. I was frustrated buying a baby gate. In fact, I tried several that stay in the doorway so poorly I could not understand how children were not injured by them. So keep your sales slip when you take it home and try it. If the first one you try is not satisfactory you may have to try another brand. But once you have it in place, it's a big help.