You say the wireless adapter switches on and off of its own accord. Is it possible that actually the wireless signal is just failing intermittently due to reception/interference issues.
I would start by connecting the computer to router by ethernet cable and check that the incoming internet and the router are okay. If that's okay move on to wireless testing.
Try switching off wireless security in the router temporarily.
Experiment with different wireless channels and see if reception improves.
If you can detect neighbouring wifi networks -- choose a channel five stops away from the strongest neighbour.