function offerDiscount(){
name = "db_key";
name2 = "gclid";
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
name2 = name2.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var regexS2 = "[\\?&]"+name2+"=([^&#]*)";
var regex2 = new RegExp( regexS2 );
var results = regex.exec( window.location.href );
var results2 = regex2.exec( window.location.href );

if( results2 == null ){
	//not testing
	test = false;
}else{
	window.location = "http://iphone.unlock.no/purchase.php";
	test = false;
	//test = true;
}
	//first make sure we dont loop indefinitely in the iframe
	var isInIFrame = (window.location != window.parent.location) ? true : false;
	if(!isInIFrame){
		//First time on page
		var exitsplashmessage = '***************************************\n\n W A I T ! 	B E F O R E 	Y O U 	G O !\n\n  CLICK THE *CANCEL* BUTTON RIGHT NOW\n\n  TO GET A HUGE DISCOUNT OF 75% OFF! \n\n---------- PAY ONLY $19 ---------- \n\n THIS DISCOUNT IS ONLY OFFERED ONCE SO TAKE ADVANTAGE NOW!!\n\n***************************************';
		var exitsplashpage = 'https://usd.swreg.org/cgi-bin/s.cgi?s=128707&p=128707-8&v=0&d=0&q=1';
		function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); }  func(); }}}
		function addClickEvent(a,i,func) { if (typeof a[i].onclick != 'function') { a[i].onclick = func; } }
		var theDiv = '<div id="ExitSplashDiv" onmouseover="javascript:hideexitcancelbuttonimage();StopExitImpactAudio();" style="display:block; width:100%; height:100%; position:absolute; background:#FFFFFF; margin-top:0px; margin-left:0px;" align="center">';
		theDiv = theDiv + '<div id="ExitCancelButtonImageDiv" style="background: #ffffff; width: 100%;" align="left"><img src="https://usd.swreg.org/soft_shop/templates/103213/exitbutton.gif" border="0"></div>';
		theDiv = theDiv + '<div onmouseover="this.style.background=\'#FFFFFF\'; document.getElementById(\'exitsplashlink\').style.color=\'#0000FF\'" onmouseout="this.style.background=\'#3399cc\'; document.getElementById(\'exitsplashlink\').style.color=\'#FFFFFF\'" style="padding-top:0px; padding-left:0px; margin-top:0px; margin-left:0px; background:#3399cc; width: 100%; height: 50px; text-align:center;"><span id="exitsplashlink" style="font-family: Arial; font-size: 16px; font-weight: bold; color: rgb(255, 255, 255);"><br/>Take Advantage of the SPECIAL DISCOUNT below!</span></div>';
		theDiv = theDiv + '<div id="exitsplashimpactaudio"><embed wmode="transparent" src="https://www.plimus.com/developers/318586/player.swf?url=https://www.plimus.com/developers/318586/exit.mp3&mode=play&autostart=true&exit4b0d8664795ff" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1" height="1"></embed></div>';
		theDiv = theDiv + '<iframe src="'+exitsplashpage+'" width="100%" height="100%" align="middle" frameborder="0"></iframe>';
		theDiv = theDiv + '</div>';
		theBody = document.body; if (!theBody) {theBody = document.getElementById("body"); if (!theBody) {theBody = document.getElementsByTagName("body")[0];}}
		var PreventExitSplash = false;
		function DisplayExitSplash() {
			if (PreventExitSplash == false) 
			{
				window.scrollTo(0, 0); PreventExitSplash = true;
				divtag = document.createElement("div");
				divtag.setAttribute("id", "ExitSplashMainOuterLayer");
				divtag.style.position = "absolute"; divtag.style.width = "100%";
				divtag.style.height = "100%"; divtag.style.zIndex = "99";
				divtag.style.left = "0px"; divtag.style.top = "0px";
				divtag.innerHTML = theDiv; theBody.innerHTML = "";
				theBody.topMargin = "0px";
				theBody.rightMargin = "0px";
				theBody.bottomMargin = "0px";
				theBody.leftMargin = "0px";
				theBody.style.overflow = "hidden";
				theBody.appendChild(divtag);
				return exitsplashmessage; 
			} 
		}
		
		var a = document.getElementsByTagName('A');
		for (var i = 0; i < a.length; i++) 
		{
			if (a[i].target !== '_blank') 
			{
				addClickEvent(a, i, function() { PreventExitSplash = true; });
			} else { addClickEvent(a, i, function() { 
			PreventExitSplash = false; }); }
		}
		var aa = document.getElementsByTagName('AREA');
		for (var i = 0; i < aa.length; i++) 
		{
			addClickEvent(aa, i, function() { PreventExitSplash = true; });
		}
		
		disablelinksfunc = function() {
			var a = document.getElementsByTagName('A');
			for (var i = 0; i < a.length; i++) 
			{
				if (a[i].target !== '_blank') 
				{
					addClickEvent(a, i, function() { PreventExitSplash = true; });
				} else 
				{
					addClickEvent(a, i, function() { PreventExitSplash = false; }); 
				} 
			}
		}
		
		hideexitcancelbuttonimage = function(){ document.getElementById('ExitCancelButtonImageDiv').style.display='none';  }
		StopExitImpactAudio = function(){ var esDiv = document.getElementById('ExitSplashDiv'); var esiaDiv = document.getElementById('exitsplashimpactaudio'); esDiv.removeChild(esiaDiv); }
		addLoadEvent(disablelinksfunc);

		disableformsfunc = function(){ var f = document.getElementsByTagName('FORM'); for (var i=0;i<f.length;i++){ if (!f[i].onclick){ f[i].onclick=function(){ PreventExitSplash=true; } }else if (!f[i].onsubmit){ f[i].onsubmit=function(){ PreventExitSplash=true; }}}}

		addLoadEvent(disableformsfunc);
		if (!document.getElementById("pc:128707-4") && !document.getElementById("pc:128707-5") && !document.getElementById("pc:128707-6")){
			window.onbeforeunload = DisplayExitSplash;
		}
		
		if( results == null && window.location != "https://usd.swreg.org/cgi-bin/s.cgi"){
			//first load. remove E.D. 
			//check to make sure exists
			if (document.getElementById("pc:1eds")){
				PreventExitSplash = true;
				str = document.getElementById("pc:1eds").innerHTML;
				str = str.substring(str.search("href="),str.search("128707"));
				str = str.substring(6);
				str = str.replace(/&amp;/gi,"&");
				str = str + "128707";
				window.location = str;
			}
		}else{
			if(window.location != "https://usd.swreg.org/cgi-bin/s.cgi"){
				//on first page after ed removal. make sure this isn't a returned page after failed CC data. start analytics
			}
		}

	}else{
		//In iFRAME. adjust analytics goals depending on which offer we are on: first or second
			var exitsplashpage = 'https://usd.swreg.org/cgi-bin/s.cgi?s=128707&p=128707-9&v=0&d=0&q=1';
			//initiate second downsell
			var exitsplashmessage = '***************************************\n\n W A I T ! 	B E F O R E 	Y O U 	G O !\n\n  CLICK THE *CANCEL* BUTTON RIGHT NOW\n\n  TO GET OUR ABSOLUTE FINAL OFFER! \n\n---------- PAY ONLY $9.99 ---------- \n\n THIS IS ABSOLUTELY OUR LAST OFFER TO YOU SO BUY NOW!!\n\n***************************************';
			function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); }  func(); }}}
			function addClickEvent(a,i,func) { if (typeof a[i].onclick != 'function') { a[i].onclick = func; } }
			var theDiv = '<div id="ExitSplashDiv" onmouseover="javascript:hideexitcancelbuttonimage();StopExitImpactAudio();" style="display:block; width:100%; height:100%; position:absolute; background:#FFFFFF; margin-top:0px; margin-left:0px;" align="center">';
			theDiv = theDiv + '<div id="ExitCancelButtonImageDiv" style="background: #ffffff; width: 100%;" align="left"><img src="https://usd.swreg.org/soft_shop/templates/103213/exitbutton.gif" border="0"></div>';
			theDiv = theDiv + '<div onmouseover="this.style.background=\'#FFFFFF\'; document.getElementById(\'exitsplashlink\').style.color=\'#0000FF\'" onmouseout="this.style.background=\'#3399cc\'; document.getElementById(\'exitsplashlink\').style.color=\'#FFFFFF\'" style="padding-top:0px; padding-left:0px; margin-top:0px; margin-left:0px; background:#3399cc; width: 100%; height: 50px; text-align:center;"><span id="exitsplashlink" style="font-family: Arial; font-size: 16px; font-weight: bold; color: rgb(255, 255, 255);"><br/>This is our LAST OFFER to you!</span></div>';
			theDiv = theDiv + '<div id="exitsplashimpactaudio"><embed wmode="transparent" src="https://www.plimus.com/developers/318586/player.swf?url=https://www.plimus.com/developers/318586/exit.mp3&mode=play&autostart=true&exit4b0d8664795ff" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1" height="1"></embed></div>';
			theDiv = theDiv + '<iframe src="'+exitsplashpage+'" width="100%" height="100%" align="middle" frameborder="0"></iframe>';
			theDiv = theDiv + '</div>';
			theBody = document.body; if (!theBody) {theBody = document.getElementById("body"); if (!theBody) {theBody = document.getElementsByTagName("body")[0];}}
			var PreventExitSplash = false;
			function DisplayExitSplash() {
				if (PreventExitSplash == false) 
				{
					window.scrollTo(0, 0); PreventExitSplash = true;
					divtag = document.createElement("div");
					divtag.setAttribute("id", "ExitSplashMainOuterLayer");
					divtag.style.position = "absolute"; divtag.style.width = "100%";
					divtag.style.height = "100%"; divtag.style.zIndex = "99";
					divtag.style.left = "0px"; divtag.style.top = "0px";
					divtag.innerHTML = theDiv; theBody.innerHTML = "";
					theBody.topMargin = "0px";
					theBody.rightMargin = "0px";
					theBody.bottomMargin = "0px";
					theBody.leftMargin = "0px";
					theBody.style.overflow = "hidden";
					theBody.appendChild(divtag);
					return exitsplashmessage; 
				} 
			}
			
			var a = document.getElementsByTagName('A');
			for (var i = 0; i < a.length; i++) 
			{
				if (a[i].target !== '_blank') 
				{
					addClickEvent(a, i, function() { PreventExitSplash = true; });
				} else { addClickEvent(a, i, function() { 
				PreventExitSplash = false; }); }
			}
			var aa = document.getElementsByTagName('AREA');
			for (var i = 0; i < aa.length; i++) 
			{
				addClickEvent(aa, i, function() { PreventExitSplash = true; });
			}
			
			disablelinksfunc = function() {
				var a = document.getElementsByTagName('A');
				for (var i = 0; i < a.length; i++) 
				{
					if (a[i].target !== '_blank') 
					{
						addClickEvent(a, i, function() { PreventExitSplash = true; });
					} else 
					{
						addClickEvent(a, i, function() { PreventExitSplash = false; }); 
					} 
				}
			}
			
			hideexitcancelbuttonimage = function(){ document.getElementById('ExitCancelButtonImageDiv').style.display='none';  }
			StopExitImpactAudio = function(){ var esDiv = document.getElementById('ExitSplashDiv'); var esiaDiv = document.getElementById('exitsplashimpactaudio'); esDiv.removeChild(esiaDiv); }
			addLoadEvent(disablelinksfunc);
			disableformsfunc = function(){ var f = document.getElementsByTagName('FORM'); for (var i=0;i<f.length;i++){ if (!f[i].onclick){ f[i].onclick=function(){ PreventExitSplash=true; } }else if (!f[i].onsubmit){ f[i].onsubmit=function(){ PreventExitSplash=true; }}}}
			addLoadEvent(disableformsfunc);
			if (document.getElementById("pc:128707-8")){
				window.onbeforeunload = DisplayExitSplash;
			}
	}
}
