What you've described is a rash of pop-ups. Consider beefing up your internet security methods. An external firewall would probably help but may also be more work/trouble than what you bargain for....hard to say since I'm not sure just how much you are willing to bargain for.
For whatever the reasons that be, the global computer culture somehow settled on unsolicited porn being one of the most typical sources behind popup storms. What's worse is, you don't even have to be intentionally looking to download/view porn to have this happen, although your odds definitely increase if you are; it can happen pretty much as the result of otherwise innocent web surfing/searching/browsing.
Popups can be thought of as the result of triggering a hidden trap door, the trap door in this case could be any of thousands of web sites that you attempt to browse.... even many web sites that for all practical purposes seem to be totally legit ones. Not making any suggestions or casting aspersions, just pointing out this is part of internet reality.....not sure why it is this way, just know from observation that it is.
For me, at least towards the beginning a few years back when I first started seeing this annoyance on a frequent basis, I turned it into a game of sorts to see how fast I could click the mouse while also manipulating the desktop to get the barage of newly opening windows closed before the rash overwhelemed. For the average home use that doesn't need to hassle with things like NT, prior to WinXP, popup storms more often than not would lead to the dreaded Blue Screen, Yikes! :) Some of the really sneaky popups will pop up their garbage (porn, advertisements, trick games, "you are a winner!!!", etc) so that these popped-up windows are put behind any other windows that may already be active on your desktop.....which makes it easier for you to not know they are there right away.....others will display themselves so that you have to go through some mouse/desktop gyrations to move some windows around, especially the popped up one you want to nuke since it displays itself on your screen in a way that the X box you need to click to close it is off screen.....pretty cute, eh? .......yeah, the things some people's stunted kids do
all because they have too much idle computer time on their hands :)
Depending on what programs you use (or would consider using if currently using none) for the general and collective purposes of security - hacking / viruses / spyware / protecting private info, you may get differing levels of relief. Many of the security programs, especially those that are considered a "suite" (a package of several security features) will automatically reduce popups as a matter of the default installation of such programs. (in other words, install the program, you now have some pop-up protection in effect). They automatically block the average popup from ever getting to your computer/display. Most of these programs have advanced functions for you to customize in hopes of further reducing those really dastardly/sneaky types of popups. Some popup methods are so stealthy they may be really difficult if not impossible to eliminate, but if you use a decent security program, you should definitely be able to reduce how often this happens to you.