Do you know the name of the program it is telling you to buy? It sounds like a SmitFraud infection -- possibly SpywareQuake or SpyFalcon. Here are some self-help tutorials that may match your symptoms:SpywareQuake Removal
Here is a link to the self help tutorial for SpyFalcon:SpyFalcon Removal
Both of these infections are very similar and will cause fake alerts trying to goad you into purchasing their product. Since they are from the same family of infections, the automated removal instructions
for them in the tutorials is the same and will remove both.
This infection could also be another variant called SpySherriff, but it's hard to tell, without knowing more description of your symptoms and without knowing what site you are redirected to if you click on the alerts.Try following the Automated Removal Instructions portion of the SpywareQuake self-help tutorial...that should fix your problem.
Let me know how it goes.