You can download free anti virus software such as Avast, AVG or AviraAnti Vira. If you decide to go for commercial products, you can buy Norton Antivirus.
Next step would be download spyware remover software such as spybot search and destroy or adaware.
Once you have installed these programs, run each of these products.
To prevent these from happening, be careful what webpages and links people have sent you before clicking. Once the software has been installed and you click on a link or website that has a virus on it, it will warn you.