function OuvrePopup() {
	// Vérifie que le cookie "ident" n'est pas présent
	if (GetCookie("ident")==null) {

		//nombre aléatoire (valeur cookie)
		//cookvalue = Math.round(Math.random() * 99999999999999);
		cookvalue = Math.floor(Math.random() * 999999999999999) + 1;

		// Enregistre le cookie pour une durée de 24 heures
		var pathname=location.pathname;
		var myDomain=pathname.substring(0,pathname.lastIndexOf('/')) +'/';
		var date_exp = new Date();
		date_exp.setTime(date_exp.getTime()+(86400*1000)); // 24h 
		SetCookie("ident",cookvalue,date_exp,myDomain);
	}
}

function SetCookie (name, value) {
	var argv=SetCookie.arguments;
	var argc=SetCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=name+"="+escape(value)+
		((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
		((path==null) ? "" : ("; path="+path))+
		((domain==null) ? "" : ("; domain="+domain))+
		((secure==true) ? "; secure" : "");
}

function getCookieVal(offset) {
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1)
      		endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
	var arg=name+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen) {
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg)
                        return getCookieVal (j);
                i=document.cookie.indexOf(" ",i)+1;
                        if (i==0) break;}
	return null;
}

function info_as(s,p)
{
	OuvrePopup();
	
	cook=window.document.cookie;
	url_system=window.document.URL;
	user_agt=navigator.userAgent;
	referer=window.document.referrer;
	screen_size_lg=screen.width;
	screen_size_ht=screen.height;
 

	url2 ='?id_societe='+escape(s);
	url2 +='&id_cookie='+escape(cook);
	url2 +='&code_url='+escape(url_system);
	url2 +='&user_agent='+escape(user_agt);
	url2 +='&referer='+escape(referer);
	url2 +='&reso='+escape(screen_size_lg)+'x'+escape(screen_size_ht);

	url2 +='&desc_page='+escape(p)

	document.write('<A HREF="http://www.themastat.com/index.php" TARGET="_blank"><IMG border=0 ALT=\"Vos statistiques personalisées\" src="http://www.themastat.com/acquisition/instat.php'+url2+'"></A>');
}
as=1;

