
function exitInit() { 

  if (unload_url != '') { 
    
    var a_tags = document.getElementsByTagName('a');
 
    for(var i = 0; i < a_tags.length; i++) {
      a_tags[i].onmousedown = function() { allow_popups = false; };
    } // end for each tag. 
 
    allow_popups = true; 

  } // end if we're doing popups. 
} // end function  


function popUnload() {
  if (allow_popups) {
  	var norm_height = 292;
    var norm_width  = 498;
	  var opts   = 'dialogTop:0px;dialogLeft=0px;scroll:no;status:0;resizable:1;help:no;edge:Sunken;dialogHeight:'+norm_height+'px;dialogwidth:'+norm_width+'px';
	
    var isXPSP2 = (window.navigator.userAgent.indexOf("SV1") != -1);
    var isIE7 = (window.navigator.userAgent.indexOf("MSIE 7.0") != -1);
    var isFF = (window.navigator.userAgent.indexOf("Firefox") != -1);
    	
    if(isIE7 || isFF){
      window.location=unload_url; 
	  // return ''+document.URL+'';
    }
    else if (isXPSP2){
      document.body.innerHTML+="<object id=iie width=0 height=0'></object>";
      iie.launchURL(unload_url);
    }
    else {
      eval(output+"('"+unload_url+"','','"+opts+"')");
	} // endif browser selection 
	//alert('test 2 '+popup_msg); 
	return popup_msg;
  } // end if we allow popups. 	  
} // end function 


// this is commented out because we have a conditional in the body which only does this IF there is a popunder ad in place. 
// this prevents javascript errors. 
//window.onload = exitInit; 

window.onbeforeunload = popUnload;

function popup_off() { 
  allow_popups = false;
}