Vicious is correct, you cannot detect where the user goes, as that would be a security/privacy issue. But, you could make every internal link on your page execute a small script which disables the popup, simply by setting a bool.
Something like this:
JavaScript Code:
var doPopup=true;
function noPop()
{
doPopup=false;
}
function getClose()
{
if(doPopup)
{
// Show the popup
}
return true;
}
document.onload=function()
{
var lnks=document.getElementsByTagName("a");
for(var i=0;i<lnks.length;i++)
{
if(lnks[i].href)
{
lnks[i].onclick=noPop;
}
}
}
This should keep the popup from appearing when you navigate within your site. The bool is automatically set back to true when the page loads one of your internal sites, but if the browser doesn't follow the link (due to some script perhaps) you'll have to reset the bool yourself.