var ClickActive = true;
function file(fichier)
 {
	 if(window.XMLHttpRequest) // FIREFOX
		  xhr_object = new XMLHttpRequest();
	 else if(window.ActiveXObject) // IE
		  xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	 else
		  return(false);
	 xhr_object.open("GET", fichier, false);
	 xhr_object.send(null);
	 if(xhr_object.readyState == 4) return(xhr_object.responseText);
	 else return(false);
 }
 
 if(typeof T_tests == "undefined") var T_tests = false;
 if(typeof T_dom == "undefined") var T_dom = false;
 function TClick(tc,stat){
	if(!ClickActive) return false;	
	if(typeof tc == "undefined") return false;	
	if(typeof stat == "undefined") stat = true;	
	var Url = (T_dom?"http://"+T_dom+"/":"/")+'trade/out.php?from=ajax&tc='+tc+(T_tests?"|"+T_tests:"")+(stat?'':'&nostats=1');	
	file(Url); 
	return true;
 }
 function TClickID(id,tc,stat){
	if(!ClickActive) return false;	
	if(typeof tc == "undefined") tc=false;	
	if(typeof stat == "undefined") stat = true;	
	var Url = (T_dom?"http://"+T_dom+"/":"/")+"trade/out.php?from=ajax";
	Url+='&idt='+id;
	if(tc) Url+='&tc='+tc+(T_tests?"|"+T_tests:"");
	if(!stat) Url+='&nostats=1';	
	file(Url);
	return true;
 }
 
 function TclickSelf(url,tc,stat){
	if(!ClickActive) return false;	
	if(typeof tc == "undefined") return false;	
	if(typeof tc == "undefined") return false;	
	if(typeof stat == "undefined") stat = true;	
	var Url = (T_dom?"http://"+T_dom+"/":"/")+'trade/out.php?from=ajax&tc='+tc+(T_tests?"|"+T_tests:"")+(stat?'':'&nostats=1');	
	file(Url);
	setTimeout(function(){
		document.location = url;
	},500);
	return false;
 }
 function TclickIDSelf(url,id,tc,stat){
	if(!ClickActive) return false;	
	if(typeof tc == "undefined") return false;	
	if(typeof tc == "undefined") return false;	
	if(typeof stat == "undefined") stat = true;	
	var Url = (T_dom?"http://"+T_dom+"/":"/")+'trade/out.php?from=ajax&tc='+tc+(T_tests?"|"+T_tests:"")+(stat?'':'&nostats=1');	
	Url+='&idt='+id;
		try{ file(Url); }catch(err) {}
	setTimeout(function(){
		document.location = url;
	},500);
	return false;
 }
 
 function LockClicksStats(){
	if(!ClickActive) return false;	
	ClickActive  = false;
	if(typeof jQuery != "undefined"){
		jQuery('a[href*=out.php]').each(function(){
			href = jQuery(this).attr('href');
			if(href.indexOf('?')==-1){
				href+="?";
			}
			href+="&nostats=1";
			jQuery(this).attr('href',href);
		});		
	}
 }


