var xiti_xitiDN = (location.protocol.indexOf('https') != -1) ? "https://logs8.xiti.com" : "http://logc8.xiti.com";

var xiti_g_s1
var xiti_g_s2

function xiti_tag(tagName){
	var Xt_param = 's=' + xiti_g_s1 + '&s2=' + xiti_g_s2 + '&di=&p=' + tagName;

	Xt_h = new Date();
	var xt_src = xiti_xitiDN + '/hit.xiti?'+Xt_param + '&hl='+Xt_h.getHours()+'x'+Xt_h.getMinutes()+'x'+Xt_h.getSeconds();
	
	xt_img = new Image();
	xt_img.style.display = 'none';
	xt_img.src = xt_src;
}

function xiti_Callback(){
	this.callback = function(url, nvlle, opt){
		opt = (opt) ? opt : "";

		if(this.TimeOutID) clearTimeout(this.TimeOutID);
		if(this.NextFnt){
			this.NextFnt();
		}
		else{
			if (url && url != '' && url != 'undefined'){
					if(!nvlle || nvlle == '' || nvlle == 'undefined' || nvlle == 'false') { 
						hsd.location = url;
					}else{
						var name = (nvlle == '_blank') ? nvlle : 'xfen';
						var xfen = window.open(url, name, opt); 
						if(xfen) xfen.focus();
					}
			}
		}
	}
}
/*

Il faut affecter une valeur à xiti_g_s1 dans la page

*/

function xiti_clic(typecl, page, url, nvlle, opt){
	hsh = new Date();
	hsd = document;
	hsr = hsd.referrer.replace(/[<>"]/g, '');
	xt_img = new Image();
	hsi = xiti_xitiDN + '/hit.xiti?s=' + xiti_g_s1 + '&s2=' + xiti_g_s2;
	hsi += '&p=' + page + '&clic=' + typecl + '&hl=' + hsh.getHours() + 'x' + hsh.getMinutes() + 'x' + hsh.getSeconds();
	if(parseFloat(navigator.appVersion) >= 4){
		Xiti_s = screen;
		hsi += '&r=' + Xiti_s.width + 'x' + Xiti_s.height + 'x' + Xiti_s.pixelDepth + 'x' + Xiti_s.colorDepth;
	}
	hsi += '&ref=' + hsr.replace(/&|\?/g, '$');
	
	var obj = new xiti_Callback();
	obj.TimeOutID = setTimeout(function(){obj.callback(url, nvlle, opt);}, 1000);

	xt_img.onload = function(){
		obj.callback(url, nvlle, opt);
	}

	xt_img.src = hsi;
}

function xiti_clicAndCall(typecl, page, nextFnt){
	hsh = new Date();
	hsd = document;
	hsr = hsd.referrer.replace(/[<>"]/g, '');
	xt_img = new Image();
	hsi = xiti_xitiDN + '/hit.xiti?s=' + xiti_g_s1 + '&s2=' + xiti_g_s2;
	hsi += '&p=' + page + '&clic=' + typecl + '&hl=' + hsh.getHours() + 'x' + hsh.getMinutes() + 'x' + hsh.getSeconds();
	if(parseFloat(navigator.appVersion) >= 4){
		Xiti_s = screen;
		hsi += '&r=' + Xiti_s.width + 'x' + Xiti_s.height + 'x' + Xiti_s.pixelDepth + 'x' + Xiti_s.colorDepth;
	}
	hsi += '&ref=' + hsr.replace(/&|\?/g, '$');
	
	var obj = new xiti_Callback();
	obj.NextFnt = nextFnt;
	obj.TimeOutID = setTimeout(function(){obj.callback();}, 1000);

	xt_img.onload = function(){
		obj.callback();
	}

	xt_img.src = hsi;
}


/*

Ne plus utiliser cette méthode ! ! ! ! ! ! !

*/
function xt_clic(typecl,section,page,url,nvlle)
{ 
	return xiti_clic(typecl,page,url,nvlle);
} 

function xt_flash(typefl,page) 
{
Xt_r = document.referrer; 
Xt_h = new Date(); 
xt_img = new Image(); 
Xt_i = xiti_xitiDN + '/hit.xiti?s='+xiti_g_s1+'&s2='+xiti_g_s2;
Xt_i += '&p='+page+'&type='+typefl+'&hl=' + Xt_h.getHours() + 'x' + Xt_h.getMinutes() + 'x' + Xt_h.getSeconds(); 
if(parseFloat(navigator.appVersion)>=4) 
{Xiti_s=screen;Xt_i += '&r=' + Xiti_s.width + 'x' + Xiti_s.height + 'x' + Xiti_s.pixelDepth + 'x' + Xiti_s.colorDepth;} 
Xt_i += '&ref=' + Xt_r.replace(/[<>"]/g, '').replace(/&|\?/g, '$'); 
xt_img.src = Xt_i; 
return; 
} 
