<!--

//======== (C) Copyright 2000 - 2006 Hook Network SARL - All rights reserved. ========
//
// The copyright to the contents herein is the property of Hook Network.
// The contents may be used and/or copied only with the written permission of
// Hook Network, or in accordance with the terms and conditions stipulated in
// the agreement/contract under which the contents have been supplied.
//
//=====================================================================================

// Noms des variables + regexp pour chacun des sites
var EPAR_KEYSCAN_SITE     = new Array('EPAR_KEYSCAN_REGEXP',     'EPAR_KEYSCAN_DB'    , null);
var ECL_C_KEYSCAN_SITE    = new Array('eCL_C_KEYSCAN_REGEXP',    'eCL_C_KEYSCAN_DB'   , null);
var EPROS_KEYSCAN_SITE    = new Array('EPROS_KEYSCAN_REGEXP',    'EPROS_KEYSCAN_DB'   , null);
var ECL_P_KEYSCAN_SITE    = new Array('eCL_P_KEYSCAN_REGEXP',    'eCL_P_KEYSCAN_DB'   , null);
var GEMC_CLI_KEYSCAN_SITE = new Array('GEMC_CLI_KEYSCAN_REGEXP', 'GEMC_CLI_KEYSCAN_DB', null);

////////////////////////////////////////////////////////////////////////////////

/**
  * Effectuer le traitement keyscan
  * @param t reference sur le tableau de div a scanner
  * @param s reference sur le tableau correspondant aux variables du site
  */
function keyscan_process(t, s)
{
	try
	{

		var i;
		
		if((s == EPAR_KEYSCAN_SITE || s == ECL_C_KEYSCAN_SITE || s == ECL_P_KEYSCAN_SITE || s == EPROS_KEYSCAN_SITE || s == GEMC_CLI_KEYSCAN_SITE) && typeof(eval(s[1])) == 'object' && t.length > 0)
		{
			if(s[2] == null)
			{
				if(typeof(eval(s[0])) == 'string')
					s[2] = new RegExp('(<!\-\- |<span id="?)' + eval(s[0]) + '( \-\->|"?><\/span>)', 'gi');
				else
					s[2] = eval(s[0]);
			}
			
			for(i = 0; i < t.length && document.getElementById(t[i]); ++i)
			{ 
				if(typeof(eval(s[0])) == 'string')
					document.getElementById(t[i]).innerHTML = document.getElementById(t[i]).innerHTML.replace(s[2], function($0, $1, $2, $3){ return (eval(s[1]))[($2.split(':'))[0]]; });
				else
					document.getElementById(t[i]).innerHTML = document.getElementById(t[i]).innerHTML.replace(s[2], function($0, $1){ return (eval(s[1]))[($1.split(':'))[0]]; });
			}
		}
	}
	catch(e)
	{
	
	}
}

//-->