function Cybermetrie(PathStat,StatClient,StatNomSite,StatGroupe,StatPage,StatSection,StatEmail,Biscuit) 
{
	Biscuit = getCookie("CyberCookie");
	// SCRIPTLOCATION -- CHANGE THE VALUE BELOW TO A URL WHERE TRACK.ASP IS INSTALLED
	// MAKE SURE YOU CHANGE THIS URL OF THE IMAGE SRC AT THE BOTTOM AS WELL
	var scriptlocation = PathStat + "recherche.asp?StatClient=" + escape(StatClient) + "&StatNomSite=" + escape(StatNomSite) + "&StatGroupe=" + escape(StatGroupe) + "&StatPage=" + escape(StatPage) + "&StatSection=" + escape(StatSection) + "&StatEmail=" + escape(StatEmail) + "&StatBiscuit=" + escape(Biscuit);
	
	// CREATE VARIABLE WITH PAGE DATA IN IT
	var pagedata = '&r=' + escape(document.referrer) + '&t=2&s=' + window.screen.width + 'x' + window.screen.height + '&z=' + Math.random(); 
	
	document.write ('<img height=1 width=1 ');
	document.write ('src="' + scriptlocation + pagedata + '">');
}

function CybermetrieForm(formName,formID,formOrdre,PathStat,FormClient,FormNomSite,FormGroupe,FormPage,FormSection) 
{
	Cookie = getCookie("CyberCookie");
	
	var frmChamps	= "";
	var frmValeurs	= "";
	var coll = document.all.item(formName);	
	
	if (coll != null) 
	{
	    for (i=0; i<coll.length; i++) 
	    {
			if (coll.item(i).type != "button" && coll.item(i).type != "submit")
			{
				frmChamps  = frmChamps + coll.item(i).name + "|"; 
				frmValeurs = frmValeurs + escape(coll.item(i).value) + "|";
			}
	    }
	}
	
	var scriptlocation = PathStat + "trackForm.asp?FormID=" + formID + "&FormOrdre=" + formOrdre + "&FormBiscuit=" + escape(Cookie);
	var pagedata = "&FormChamps=" + frmChamps + "&FormValeurs=" + frmValeurs + "&FormClient=" + FormClient + "&FormNomSite=" + FormNomSite + "&FormGroupe=" + FormGroupe + "&FormPage=" + FormPage + "&FormSection=" + FormSection;

	//alert(scriptlocation + pagedata);
		
	document.write ('<img height=1 width=1 ');
	document.write ('src="' + scriptlocation + pagedata + '">');	

	//window.submit();
}

function getCookie(name) 
{ // use: getCookie("name");
	var bites = document.cookie.split("; "); // break cookie into array of bites
	
    for (var i=0; i < bites.length; i++) 
	{
      	nextbite = bites[i].split("="); // break into name and value
      	if (nextbite[0] == name) // if name matches
        	return unescape(nextbite[1]); // return value
    }
	
	// TRAITEMENT DU COOKIES =======================================================================================
	var today		= new Date();
	var date		= today.toDateString() + "-" + today.toTimeString();
	var valCookie	= document.location.hostname + "-" + date + "-" + Math.round(Math.random()*1000);   
	
	setCookie("CyberCookie", valCookie);
	return valCookie;
}

function setCookie(name, value) 
{ // use: setCookie("name", value);
	var today 	= new Date();
	var expiry 	= new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000); // 1 an 

    if (value != null && value != "")
    	document.cookie = name + "=" + escape(value) + "; expires=" + expiry.toGMTString();
    //bites = document.cookie.split("; "); // update cookie bites
}
