Maybe something with javascript:
In the link to the banner page:
onclick="Refresh()"
<SCRIPT LANGUAGE="javascript">
function Refresh(){
location.href= <page location><download=yes>;
}
In the popup body tag something like onunload="refresh2()
function refresh1()
{
location.<mainwindowname>.href= <page location><download=no>
}
Then you have to make sure PhP has a link which works when download=yes, and a link which doesn't work when download is no.
This is not completely functional, since I am not sure of the javascript commands, but you get the idea, I think. The first part can be achieved with only PhP I am sure (Make a link to the page, where you change the setting to download. and a popup. Then you only need javascript I think for the disabeling of the link.
Good luck.
Jelle.