Many sites of ill repute use a technique that causes the following distressing situation - when you try to leave the site, either by using the Back button or by closing the browser, the site reappears in a new window. In the worst cases, the site pops up in three or four new windows when you try to leave it, and basically the only way out is to shut down your computer. The way most people get trapped into these sites is through listings in search engines that look legitimate but clearly are not once you click on them.
The way these sites work is as follows. If you have read the HSW article entitled How Web Pages Work, you know that the HTML code for the simplest web pages looks like this:
<title>My First Page</title>
Content of the page goes here...!
The tag <body> marks the beginning of the body of the page. You are allowed to modify the body tag. For example, if you change it so it looks like <body bgcolor=yellow>, then the background color of the page will be yellow.
flag = 1;
When the replay function gets called, you can see that all it does is open a new window that contains whatever page is requested (here it's www.blahblahblah.com). There's nothing to stop the creator of the web page from opening up multiple windows - simply adding 4 more "open" lines to the replay function will cause 5 new windows to open. If they all do the same thing, your screen quickly fills with dozens of windows. That's when you have to shut down.
The use of the flag variable is interesting. That's there because, if the page contains a link, it causes onUnload to get triggered when the link is clicked. So the link will contain the following code:
This turns off the replay function if the user clicks the link on the page.