<!--
// Weboscope Performance - performance.js version 2.1
// Weboscope is a trademark property of weborama
// http://www.weborama.com
// Last edit  06/09/2007

////////////////////////
// Performance Class //
//////////////////////

// location
var WPERF_SERVER = ".weborama.fr";
var WPERF_PRGM = "/fcgi-bin/performance.fcgi";

function performancePassage(_FID_SITE, _ID_TRANSFO, _ID_PASSAGE)
{
    // Attributs
    this.FID_SITE = _FID_SITE;
    this.ID_TRANSFO = _ID_TRANSFO;
    this.ID_PASSAGE=_ID_PASSAGE;
    this.ACTION = 3;
	
    // Fonctions
    this.getURL = getURL;
    this.execute = execute;
}

function performanceScenario(_FID_SITE, _ID_TRANSFO, _ID_SCENARIO)
{
    // Attributs
    this.FID_SITE = _FID_SITE;
    this.ID_TRANSFO = _ID_TRANSFO;
    this.ID_SCENARIO = _ID_SCENARIO;
    this.ACTION = 4;
	
    // Fonctions
    this.getURL = getURL;
    this.execute = execute;
}

function performanceParam(_K, _V) {this.key = _K; this.value = _V;}

function performanceTransfo(_FID_SITE, _ID_TRANSFO)
{
    // Attributs
    this.FID_SITE = _FID_SITE;
    this.ID_TRANSFO = _ID_TRANSFO;
    this.ID_ACHAT = 0;
    this.ID_CLIENT = 0;
    this.MONTANT_ACHAT = 0; // ascii value
    this.ARTICLE = 0;
    this.A_VALIDER = 0;
    this.ACTION = 2;	
	this.PARAMS = new Array();
	
    // Fonctions
    this.setAmount = setAmount;
    this.setId = setId;
    this.setClient = setClient;
	this.setQuantity = setQuantity;
    this.setPostValidation = setPostValidation;
    this.getURL = getURL;
	this.addParam = addParam;
    this.execute = execute;
}

function setAmount(_PRICE){this.MONTANT_ACHAT = _PRICE;}
function setId(_ID){this.ID_ACHAT = _ID;}
function setClient(_ID){this.ID_CLIENT = _ID;}
function setQuantity(_NB){this.ARTICLE = _NB;}
function setPostValidation(_V){this.A_VALIDER = _V;}
function addParam(_K,_V){this.PARAMS.push(new performanceParam(_K, _V));}

function getURL()
{
    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 + "&A=" + this.ACTION;
    wbs_arg += "&TR=" + this.ID_TRANSFO;
    
    if (this.ID_CLIENT != null && this.ID_CLIENT != 0){wbs_arg += "&CL=" + escape(this.ID_CLIENT);}
    if (this.ID_ACHAT != null && this.ID_ACHAT != 0){wbs_arg += "&AC=" + escape(this.ID_ACHAT);}
    if (this.MONTANT_ACHAT != null && this.MONTANT_ACHAT != 0){wbs_arg += "&MA=" + escape(this.MONTANT_ACHAT);}
    if (this.ARTICLE != null && this.ARTICLE != 0){wbs_arg += "&AR=" + this.ARTICLE;}
    if (this.ID_PASSAGE != null){wbs_arg += "&PT=" + this.ID_PASSAGE;}
    if (this.ID_SCENARIO != null){wbs_arg += "&SC=" + this.ID_SCENARIO;}
    if (this.A_VALIDER != null){wbs_arg += "&AV=" + this.A_VALIDER;}
    wbs_arg += "&da=" + wbs_da; 
	if (this.PARAMS.length) {
		wbs_arg += "&OPT=";
		for(i = 0; i < this.PARAMS.length; i++) {
			wbs_arg += escape(this.PARAMS[i].key)+':'+escape(this.PARAMS[i].value)+';';
		}
	}
	return wbs_arg;
}

function execute()
{
    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 ON /OFF //
//////////////////////////////////

webo_performance = 1;

//-->

