
onkeydown = function(e) {
		if (e.which == 116){ ShowPopUp = false;}
	};
 
 onbeforeunload = function(oEvent){
	return WarningOnExit(oEvent);
	} ;
 
ShowPopUp = true;
strOKMessage = "Thank you for visiting our site.\n\n As a Special Thank You for visiting the site,\n you can enter for a chance to win a $25,000 Dream Come True SweepsTakes! \n\n Click 'Cancel' in the next window to enter. ";
strCancelMessage = "Click 'Cancel' to enter for a chance to win the $25,000 Dream Come True SweepsTakes.";
strURL = "https://www.mybonuscenter.com/10006958";
function WarningOnExit(e) 
{
		
	var domainname = "http://" + location.host;
	if((location.host != "64.225.152.55")  && (location.host !="www.lfstage.com"))	
	{
		var ev=(!e)?window.event:e;//IE:Moz
		if (ev.pageX){//Moz			
			posx=ev.pageX;
			posy=ev.pageY;			
			}
		else 
		{
			posx=ev.clientX;
			posy=ev.clientY;	
		}	
		
		var PopUpsBlocked = false;	
		if (navigator.userAgent.indexOf("MSIE")!=-1) 
		{	
			
			
			if((posy<-10) && (posx > 50 ))
			{
				if(ShowPopUp == true )
				{
							
					//var mywindow = window.open(domainname + '/include/majorsavings.html','GiftCard','width=360,height=390,scrollbars=yes,maximized=yes,resizable=yes')
					//if(mywindow )
    				//	PopUpsBlocked = false
 					//else
    					PopUpsBlocked = true
    				if(PopUpsBlocked == true )
    				{
    					alert(strOKMessage);
    					window.event.returnValue = strCancelMessage;			
  			  			document.location = strURL;
    				}

				}
				else
				{			
				ShowPopUp = true;
				}
			}
		}
	    else
		{	
			if(ShowPopUp == true )
			{			
				
				//var mywindow = window.open(domainname + '/include/majorsavings.html','GiftCard','width=360,height=390,scrollbars=yes,maximize=yes,resizable=yes')		
				
				//if(mywindow != null)
    			//	PopUpsBlocked = false
 				//else
    				PopUpsBlocked = true
    			
    			
    			if(PopUpsBlocked == true )
    			{	
    				
    				alert(strOKMessage);
    											
    				if (navigator.userAgent.indexOf("Safari")!=-1 ) 
					{	
						onbeforeunload = null;	
						document.location = strURL;												
						return strCancelMessage;	
					  					
					}
					else
					{
						document.location = strURL;   
    					ev.returnValue  = strCancelMessage;	
    					
    				}		
					
    				
				}
				else
				{					
					if (navigator.userAgent.indexOf("Chrome")!=-1 ) 
					{	
						alert(strOKMessage);
						onbeforeunload = null;		
						document.location = strURL;								
						return strCancelMessage;	
												

					}
				}
												
			}
			else
			{			
				ShowPopUp = true;
			}		
		}
	}
	
}


function GetWidth()
{
        var x = 0;
        if (self.innerHeight)
        {
                x = self.innerWidth;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        {
                x = document.documentElement.clientWidth;
        }
        else if (document.body)
        {
                x = document.body.clientWidth;
        }
        return x;
}




