<!--
/* Weboscope Performance - wbo_performance_rnat.js version 1.0
   Weboscope is a trademark property of Weborama
   http://www.weboscope.com
   Derniere modification le  01/03/2007 */

/* Performance Ref Nat Class */



/* Location */
var WPERF_SERVER = ".weborama.fr";
var WPERF_PRGM = "/fcgi-bin/performance.fcgi";

function performanceRefNat()
{
    /* Attributs */
    this.FID_SITE = 375405;
    this.cookieSITE = 'perfvisite'+this.FID_SITE;
    
    this.C_RNAT = 5861;
    this.P_GOOGLE = 12323;
    this.L_GOOGLE_FR = 116529;
    this.L_GOOGLE_COM = 116528;
    this.L_GOOGLE_OTH = 116527;

    this.P_MSN = 12326;
    this.L_MSN_FR = 116539;
    this.L_MSN_COM = 116541;
    this.L_MSN_OTH = 116543;

    this.P_VOILA = 12324;
    this.L_VOILA_FR = 116530;

    this.P_YAHOO = 12325;
    this.L_YAHOO_FR = 116531;
    this.L_YAHOO_COM = 116546;
    this.L_YAHOO_OTH = 116548;

    this.P_AOL = 12322;
    this.L_AOL_FR = 116526;
    this.L_AOL_COM = 116534;
    this.L_AOL_OTH = 116536;

    this.P_NEUF = 12327;
    this.L_NEUF_FR = 116550;

    this.P_ALICE = 12321;
    this.L_ALICE_FR = 116525;

    this.P_OTHERS = 12328;
    this.L_OTHERS = 116551;
  
    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.parseMSN = parseMSN;
    this.parseVOILA = parseVOILA;
    this.parseYAHOO = parseYAHOO;
    this.parseAOL = parseAOL;
    this.parseNEUF = parseNEUF;
    this.parseALICE = parseALICE;
    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.parseMSN()) return 1;
  if (this.parseYAHOO()) return 1;
  if (this.parseVOILA()) return 1;
  if (this.parseAOL()) return 1;
  if (this.parseNEUF()) return 1;
  if (this.parseALICE()) return 1;
  if (this.NEED_PARSE_OTHERS) return this.parseOTHERS();  
  
  return 0;
}

function parseVOILA()
{
  if (this.REF_DOMAIN.indexOf('.voila.fr') >= 0)
  { 
    this.P_USED = this.P_VOILA;
    this.L_USED = this.L_VOILA_FR;
    return 1;
  } 
  return 0;
}

function parseNEUF()
{
  if (this.REF_DOMAIN.indexOf('.neuf.fr') >= 0)
  { 
    this.P_USED = this.P_NEUF;
    this.L_USED = this.L_NEUF_FR;
    return 1;
  } 
  return 0;
}

function parseALICE()
{
  if (this.REF_DOMAIN.indexOf('.aliceadsl.fr') >= 0)
  { 
    this.P_USED = this.P_ALICE;
    this.L_USED = this.L_ALICE_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 parseMSN()
{
  if (this.REF_DOMAIN.indexOf('.msn.') >= 0)
  { 
    this.P_USED = this.P_MSN;
    this.L_USED = this.L_MSN_OTH;
    if (this.REF_DOMAIN.indexOf('.msn.fr') >= 0) this.L_USED = this.L_MSN_FR;
    if (this.REF_DOMAIN.indexOf('.msn.com') >= 0) this.L_USED = this.L_MSN_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;
    else if (this.REF_DOMAIN.indexOf('.yahoo.com') >= 0) this.L_USED = this.L_YAHOO_COM;
    return 1;
  } 
  return 0;
}

function parseAOL()
{
  if (this.REF_DOMAIN.indexOf('.aol.') >= 0)
  { 
    this.P_USED = this.P_AOL;
    this.L_USED = this.L_AOL_OTH;
    if (this.REF_DOMAIN.indexOf('.aol.fr') >= 0) this.L_USED = this.L_AOL_FR;
    if (this.REF_DOMAIN.indexOf('.aol.com') >= 0) this.L_USED = this.L_AOL_COM;
    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 or 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;

//-->