//This page alows the exit popups to spawn only on site exit or changing URL
//Victor February 03.03.2002
//Initialise
var ActionExit = 1;  
var HoldClick = 0;

var isNav; 

if (parseInt(navigator.appVersion) >= 4) {
    if (navigator.appName == "Netscape") {isNav = true;} 
}
 
//This Funtion Always Needs To Be Here
//This Will Allow The Div Popin To Spawn and Exit To Function
//-------------------------------------------------------------
	function HoldClickEvent(){
		}

	function Catchclick(PassVal) {
		if(	HoldClick !=1){
    		ActionExit = 0;
	    	if (isNav) { document.routeEvent(PassVal); }
    		return true;
		}else{	
			HoldClick = 0;
    		return false;
		}
	}
//--------------------------------------------------------------	



	function exiting() {
    	if (ActionExit) {
		
//**********************************************************************************************
			try
				{
					if(show_ending_pop_up == 1)
						{
							window.open('http://www.fortunelounge.eu/b4ugo/default.asp?btag=' + btag+'&referrer='+location.hostname);
							//window.open('http://itdev015/fortunelounge/b4ugoPP/default.asp?btag=' + btag);
							focus(); 		
						}
				}
			catch(er)
				{
					window.open('http://www.fortunelounge.eu/b4ugo/default.asp?btag=' + btag+'&referrer='+location.hostname);
					//window.open('http://itdev015/fortunelounge/b4ugoPP/default.asp?btag=' + btag);
					focus(); 		
				}
//******End PopUp Command section
//***********************************************************************************************
	 }
    	return true;
	}

	function ExitWatch(func) {
    	Leave0 = func;
	    Leave1 = window.onunload;
	    window.onunload = new Function ("Leave0(); if (Leave1 != null) Leave1();");
	}	

//Default Function Calls
	if (isNav) {
    	document.captureEvents(Event.CLICK | Event.UNLOAD | Event.LOAD | Event.ERROR);
	}

	document.onclick = Catchclick;
	
	ExitWatch(exiting);
