//The following content is Copyright ©2005 Advanced Data Network.
//Please contact Advanced Data Network by e-mail at adn@adnsa.com if you want to use a part or the whole of it.

/**
* On recupere toutes les balises html de body
* Surbrillance V2 9 12 04
*
**/
//window.status="OK";
//if(word == "titi")
//{
function afficheSurbillance(motsearch)
{

var word = motsearch;
var HTML="";
var TEXT="";
//alert("surbrillance");

if (navigator.appName=="Netscape")
{
// si safari on pass ici aussi
theBody = document.getElementsByTagName("BODY");
HTML = theBody[0].innerHTML;
} 
if (navigator.appName=="Microsoft Internet Explorer")
{
   bodyNodes = document.body.childNodes;
	 for (var i=0; i<bodyNodes.length;i++){
	  if(document.body.childNodes[i].tagName!="SCRIPT")
	   HTML+=document.body.childNodes[i].outerHTML;
	 }
} 

NBLOOP=word.length;
for(i=0;i<NBLOOP;i++)
{
	word[i]=translate(word[i]);
	//alert(word[i]);
} 
var table = HTML.split("<");
HTML="";
for (t = 0; t < table.length ; t++){
//if (table[t].charAt(0)!="/"){
var psup =table[t].indexOf(">");
  
var html_tag =table[t].substring(0,psup+1);//isolement des balises
var html_text =table[t].substring(psup+1);//isolement du text
var pscript = html_tag.toLowerCase().indexOf("script");//isolement des scripts
if (pscript==-1){
  //////////////////////////////////////////////////////
   for (var zz=0;zz<word.length;zz++){
   //alert(word[zz]);
	  var p = html_text.toLowerCase().indexOf(word[zz].toLowerCase());
	   while (p!=-1){
	   if (p!=-1){
	    html_text = html_text.substring(0,p)+"<nobr>"+html_text.substring(p,p+word[zz].length)+"</nobr>"+html_text.substring(p+word[zz].length);
	    }// fin if p
	   p = html_text.toLowerCase().indexOf(word[zz].toLowerCase(),p+7);// car on rajoute<nobr>
	  }// fin while p
	}// fin for zz
  
  table[t] = html_tag+html_text;   
}// if script  
 /////////////////////////////////////////////////////// 	
//	}// fin charat 
document.write(table[t]+"<br>\r\n"); 
   if (t>0)
    HTML +="<"+table[t];
   else
   	  HTML +=table[t];
	  
 }// fin for 
//alert(HTML);
document.body.innerHTML=HTML;
//alert("aie surbrillance");



}


function translate(STRINGIN)
{
	var UNI = new Array("&#281","&#243","&#261","&#347","&#322","&#380","&#378","&#263","&#324","&#280","&#211","&#260","&#346","&#321","&#379","&#377","&#262","&#323");
	//var NBLOOP = STRINGIN.length;
	var STRINGOUT=""
	var NBUNI=UNI.length;
	for(j=0;j<NBUNI;j++)
	{
		if(STRINGIN.indexOf(UNI[j]) > -1)
		{
			CAR=String.fromCharCode(UNI[j].substring(2, UNI[j].length));
			STRINGOUT=STRINGIN.replace(UNI[j]+";",CAR);
			STRINGIN=STRINGOUT;
		}
	}
	//alert("STRINGIN="+STRINGIN);
	return STRINGIN;
}
