I am attempting to reinstall a switch in a room in my house. Within the box there are two cables. The cable on the left has a black and white wire. The cable on the right has three wires a black, a white, and a red wire. The way it is currently hooked up is that the red wire is pigtailed off, the white wires are pigtailed together and the black wires are connected to either ends of a single pole switch.
The problem is that this configuration results in the switch controlling both the lights and the outlets in the room. So when the switch is turned off it would remove power to the outlets as well as the overhead light.
After doing a bit or research I think I have a light switch in the middle of a circuit. I think it is probably like the wiring diagram in the following link "Power at switch diagram".
What would be the correct way of installing this switch? Are there any suggestions for how I can figure out how the circuit is connected in my house?