The second charger was coming apart and I was curious to see how it worked. Since the cover was already loose, I opened it up to take a look. I will put it back together when I'm done.
The thick red wires are from the mains input to the small transformer and the blue wires are from the transformer to the pcb. The black and purple wire are to the switch. The yellow, orange, red, and brown go to the positive battery connection. The other black wire is to the negative connections to all the batteries.
To test the batteries after I charge them, I use a Radio Shack 22-080 battery tester. If they drain quickly during the test, I discard them. My city doesn't recycle regular batteries any more, but I will keep searching for a place that will take them.