/***********************************************
|A|n|d|y|S|o|w|a|r|d|s|.|c|o|m|
------------------------------------------
* Easy Javascript/PHP Exit Pop up script @ AndySowards.com Developer's Blog (www.andysowards.com)
* This notice MUST stay intact for legal use
* Visit Andy Sowards at http://www.andysowards.com/ for full source code
***********************************************/

//EDIT HERE ONLY




var ExitPopURL = 'http://www.gptinfinity.com/index6a.php?rf=6'; //This is the URL where your 'exit page' is located.
/* NOTE: If you experience an error it is most likely due to the strict AJAX security, make sure that you are accessing the correct URL, for example, if you have http://domain.com in your browser, and http://www.domain.com in the 'ExitPopURL' then there will be a conflict. they must both match. .htaccess to ensure that your visitors are visiting www. is good practice here.*/
var AlertBox = "***************************************\n\n         > > > W A I T < < <\n\n  Click the **CANCEL** BUTTON\n\n  to GET CASH for your OPINION!\n\n"; // This is what the alert() pop up verbage says.
var exitalertmessage = '***************************************\n\n         > > > W A I T < < <\n\n     CLICK THE **CANCEL** BUTTON\n           on the NEXT WINDOW\n\n      Trade your OPINION for CASH!!!\n\n              FREE MEMBERSHIP!\n             100% FREE SURVEYS!\n             JOIN TODAY! \n\n***************************************';
//DO NOT EDIT BELOW This LINE (Unless of course your Savvy!) ------------------------------



window.onload = function(){

//document.bgColor="#FFFFFF";
	
// this is where we start our journey...
	createExitPop();
}// end function onunload

function ajaxGET(divId, page, effect) 
{ 
     var xmlHttp; 
     try 
    { 
         // Firefox, Opera 8.0+, Safari 
         xmlHttp=new XMLHttpRequest(); 
    } 
     catch(e)   
    { 
         // Internet Explorer 
         try 
         { 
              xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
         } 
         catch(e)   
          { 
               try 
               { 
                    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 
               } 
               catch(e)   
             {      
                    alert("Your browser does not support AJAX!"); 
                  return false; 
             } 
         } 
     } 
      
    xmlHttp.onreadystatechange=function() 
     {      
		
		 if(xmlHttp.readyState==4) 
          { 		  
               if(effect == 'collapse') { document.getElementById(divId).style.display='none'; } 
               else                     { document.getElementById(divId).innerHTML=xmlHttp.responseText; } 
         } 
    } 

     xmlHttp.open("GET",page,true); 	 
    xmlHttp.send(null); 
}

function createExitPop()
{
	

var theBody = document.getElementsByTagName('body')[0]; 
	var newdiv = document.createElement('div');
	newdiv.setAttribute('id','ExitDiv');
	theBody.setAttribute('id','body');
	newdiv.setAttribute('style', 'width: 100%; height: 100%;');
	
		// put div on page
		theBody.appendChild(newdiv);
	
		//add exit pop to page (contents are from your exit.php(or whatever you named it) page)
		
		document.getElementById('ExitDiv').value = ajaxGET('ExitDiv', ExitPopURL);                       
	        // style exit pop to resemble its own page
        
        document.getElementById('ExitDiv').style.display = "none"; 
	document.getElementById('ExitDiv').style.top = '0px'; 
	document.getElementById('ExitDiv').style.left = '0px'; 
	document.getElementById('ExitDiv').style.position = 'relative'; 
	document.getElementById('ExitDiv').style.backgroundColor = '#FFFFFF';
	
}// end createExitPop

isExit = true;

function ExitPop(isExit) {

		if(isExit != false)	{
			isExit=false;
			isPop = true;
			
			var bodyTag = document.getElementById? document.getElementsByTagName("BODY")[0] : document.body;
			
			// add id="body" so that it can be referenced.
			bodyTag.setAttribute("id", "body");
			
			//replace body text with exit pop
			bodyTag.innerHTML = document.getElementById('ExitDiv').innerHTML;						
            
                        //bodyTag.innerHTML+='<embed wmode="transparent" src="http://exitsplash.s3.amazonaws.com/player.swf?url=http://gptinfinity.com/pop.mp3&mode=play&autostart=true&exit4afdf0f2f281c" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1" height="1"></embed>';                                       
    
                        //bodyTag.innerHTML+="<EMBED SRC=\"pop.wma\" autostart=\"true\" VOLUME=\"50\" HEIGHT=\"0\" WIDTH=\"0\" hidden=\"false\">";                    
                         
                        alert(exitalertmessage);
			
			window.location.href="http://www.gptinfinity.com/index6a.php?rf=6"; 
                        //window.location.href="http://affiliate.irotracker.com/rd/r.php?sid=561&pub=400013&c1=";	
                         
			return AlertBox;			
		} // end if
            
		
	}// end function

window.onbeforeunload = function(){		
		// Lay down an exit pop!!
                
		return ExitPop(isExit);
	
}// end function onunload		