var popup = true;

function startDetection(){
	popup = false;
	/*
	var a = document.getElementsByTagName('a');			
	var img = document.getElementsByTagName('img');	
	
	for(var i = 0; i < a.length; i++){
		a[i].onclick = onc;
		a[i].onmousedown = onc;
	}
	for(var j = 0; j < img.length; j++){
		img[j].onclick = onc;
		img[j].onmousedown = onc;
	}		
	*/
}
/*
function onc(){				
	popup = false;	
}
*/
function sinartraFunction(){

  	var today = new Date();
  	var startDay = new Date(2009,7,6);
	
	var getURL = window.location.href;
	var getRef = document.referrer;
	var getLang = getURL.substring(7,9);
	var isGooglePPC = getRef.indexOf("www.google");
	var isTradeDoubler = getRef.indexOf("tradedoubler.com");
	var isTsw = getRef.indexOf("tsw0.com");

	if(getLang == "ww"){
		getLang = "en";
	}

	if(today >= startDay && getLang == "en" || getLang == "de" || getLang == "fr" && (isGooglePPC == -1 || isTradeDoubler == -1 || isTsw == -1)){	
		function getCookie(){
			if(document.cookie.length > 0){
				
				var c_name = "hasInstallEnd";
				
				c_start = document.cookie.indexOf(c_name + "=");
				if(c_start!=-1){					
					c_start = c_start + c_name.length + 1;
					c_end = document.cookie.indexOf(";",c_start);
					
					if(c_end == -1){
						c_end=document.cookie.length;
					}
					return unescape(document.cookie.substring(c_start,c_end));
				}
			}
		return "false";
		}	
	}

	if(getCookie() != "true" && popup && getLang == "en" || getLang == "de" || getLang == "fr"  && (isGooglePPC == -1 || isTradeDoubler == -1 || isTsw == -1)){
		window.open('/exit/sinatra/flash.html','hell','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=720,height=450,top=100,left=100');
	}			
}

//window.onclick = startDetection;	
//window.onmousedown = startDetection;	
//window.onunload = sinartraFunction;


	
		
