This kind of attack is called scareware. They scare you to think that you have virus and tries to sell you a software which does more harm.

to protect your PC you require three things.

Firewall, usually a built in (in windows).
Antivirus, AVG is the best, free and does not cripple your PC like Norton.

Spyware or adware protection. Windows defender is a good one for windows xp. its free and already built in vista.

You still have to be vigilant when you surf the net. You can unintentionally accept harmful software to be installed thinking they are from a trusted site.

If reinstalling windows is easy for you that it is highly recommended.