<!--
// Weboscope Performance - wbo_performance_rnat.js version 2.1
// Version Yoolink
// Weboscope is a trademark property of weborama
// Derniere modification le  02/2009

////////////////////////////////
// Performance Ref Nat Class //
//////////////////////////////

// location
var WPERF_SERVER = ".weborama.fr";
var WPERF_PRGM = "/fcgi-bin/performance.fcgi";

function performanceRefNat()
{
    // Attributs
    this.FID_SITE = 305176;
    this.cookieSITE = 'perfvisite'+this.FID_SITE;
    
    this.C_RNAT = 6852;
    this.P_GOOGLE = 14197;
    this.L_GOOGLE_FR = 138909;
    this.L_GOOGLE_COM = 137767;
    this.L_GOOGLE_OTH = 138910;


    this.P_LIVE = 14202;
    this.L_LIVE_COM = 137770;

    this.P_ORANGE = 14200;
    this.L_ORANGE_FR = 137771;

    this.P_YAHOO = 14199;
    this.L_YAHOO_FR = 137773;
    this.L_YAHOO_OTH = 138911;

    this.P_TWITTER = 14201;
    this.L_TWITTER_COM = 137772;

    this.P_OTHERS = 14236;
    this.L_OTHERS = 138912;
	
	this.C_USED = this.C_RNAT;
	this.P_USED = this.P_OTHERS;
	this.L_USED = this.L_OTHERS;
		
	this.NEED_PARSE_OTHERS = 1;
	
    // Fonctions
    this.launchParsing = launchParsing;
    this.parseGOOGLE = parseGOOGLE;
    this.parseLIVE = parseLIVE;
    this.parseORANGE = parseORANGE;
    this.parseYAHOO = parseYAHOO;
    this.parseTWITTER = parseTWITTER;
    this.parseOTHERS = parseOTHERS;
    this.getURL = refnatgetURL;
    this.setParseOthers = setParseOthers;
    this.execute = refnatexecute;
    this.doRequest = refnatdoRequest;
}

function setParseOthers(_VALUE)
{
	this.NEED_PARSE_OTHERS = _VALUE;	
}

function refnatexecute()
{
	if (webo_performance_rnat == 0) return 1;
	if (document.cookie.indexOf(this.cookieSITE) >= 0) return 2;

	var cur_domaine = document.location.host;
	var a_points = cur_domaine.split('.');
	if (a_points.length > 2) 
		cur_domaine = cur_domaine.substring(cur_domaine.indexOf('.')+1, cur_domaine.length);
	
	if (document.referrer)
	{
		this.REFERRER = document.referrer.toLowerCase();

		this.REF_DOMAIN = this.REFERRER;
		var a_div = this.REF_DOMAIN.split('/');	
		for (i = 2; i < a_div.length; ++i)
		{
			if (a_div[i].length)
			{
				this.REF_DOMAIN = a_div[i];
				i = a_div.length;
			}
		}					
//		if (this.REF_DOMAIN.indexOf(cur_domaine) == -1)
//		{
			if (this.launchParsing()) this.doRequest();
//		}
	}
	document.cookie = this.cookieSITE+"=1;path=/";
	return 0;
}

function launchParsing()
{
	if (this.parseGOOGLE()) return 1;
	if (this.parseLIVE()) return 1;
	if (this.parseYAHOO()) return 1;
	if (this.parseORANGE()) return 1;
	if (this.parseTWITTER()) return 1;
	if (this.NEED_PARSE_OTHERS) return this.parseOTHERS();	
	
	return 0;
}

function parseORANGE()
{
	if (this.REF_DOMAIN.indexOf('.voila.fr') >= 0)
	{ 
		this.P_USED = this.P_ORANGE;
		this.L_USED = this.L_ORANGE_FR;
		return 1;
	}	
	return 0;
}


function parseGOOGLE()
{
	if (this.REF_DOMAIN.indexOf('.google.') >= 0)
	{ 
		this.P_USED = this.P_GOOGLE;
		this.L_USED = this.L_GOOGLE_OTH;
		if (this.REF_DOMAIN.indexOf('.google.fr') >= 0) this.L_USED = this.L_GOOGLE_FR;
		if (this.REF_DOMAIN.indexOf('.google.com') >= 0) this.L_USED = this.L_GOOGLE_COM;
		return 1;
	}	
	return 0;
}

function parseLIVE()
{
	if (this.REF_DOMAIN.indexOf('.msn.') >= 0)
	{ 
		this.P_USED = this.P_MSN;
		this.L_USED = this.L_LIVE_COM;
		if ((this.REF_DOMAIN.indexOf('.msn.fr') >= 0) || (this.REF_DOMAIN.indexOf('.msn.com') >= 0) || (this.REF_DOMAIN.indexOf('.live.fr') >= 0) || (this.REF_DOMAIN.indexOf('.live.com') >= 0)) this.L_USED = this.L_LIVE_COM;
		return 1;
	}	
	return 0;
}

function parseYAHOO()
{
	if (this.REF_DOMAIN.indexOf('.yahoo.') >= 0)
	{ 
		this.P_USED = this.P_YAHOO;
		this.L_USED = this.L_YAHOO_OTH;
		
		if (this.REF_DOMAIN.indexOf('fr.search.yahoo.com') >= 0) this.L_USED = this.L_YAHOO_FR;
		else if (this.REF_DOMAIN.indexOf('.yahoo.fr') >= 0) this.L_USED = this.L_YAHOO_FR;
		return 1;
	}	
	return 0;
}

function parseTWITTER()
{
	if (this.REF_DOMAIN.indexOf('.twitter.com') >= 0)
	{ 
		this.P_USED = this.P_TWITTER;
		this.L_USED = this.L_TWITTER;
		return 1;
	}	
	return 0;
}

function parseOTHERS()
{
	if (this.REF_DOMAIN.length)
	{
		this.REFERRER = "?Q="+escape(this.REF_DOMAIN);
		return 1;
	}
	return 0;
}

function refnatgetURL()
{
    var wbs_da = new Date();
    wbs_da = parseInt(wbs_da.getTime()/1000 - 60*wbs_da.getTimezoneOffset());
    
    // Connection type auto detection : HTTP ou HTTPS
    var WEBO_CONNEXION = (location.protocol == 'https:')?"https://ssl":"http://perf";
        
    var wbs_arg = WEBO_CONNEXION + WPERF_SERVER + WPERF_PRGM + "?ID=" + this.FID_SITE + "&RN=1&A=1&T=I&W=1";
    wbs_arg += "&C=" + this.C_USED + "&P=" + this.P_USED + "&L=" + this.L_USED;
    wbs_arg += "&URL=http%3A%2F%2Fstatic.weborama.fr%2Fimages%2Ftransp.gif";
    wbs_arg += "&RND=" + wbs_da;    
    wbs_arg += "&NREF="+escape(this.REFERRER);

    return wbs_arg;
}

function refnatdoRequest()
{
    if (parseInt(navigator.appVersion) >= 3)
	{
	    webo_compteur = new Image(1,1);
	    webo_compteur.src = this.getURL();
	}
    else
	{
	    document.write("<img src='" + this.getURL() + "' border='0' height='1' width='1' alt=''>");
	}
}

////////////////////////////////////
// Weboscope performance Ref Nat ON /OFF //
//////////////////////////////////

webo_performance_rnat = 1;

//-->




