/******************************************************************************************
PROJET REACT

PROPRIETE TELIDE SA : REPRODUCTION INTERDITE SANS AUTORISATION
Tous les documents notamment textuels, sonores, vidéos ou autres (directement visibles ou invisibles comme le code des pages) sont la propriété de TELIDE S.A. . 
L'ensemble de cette production est donc protégée par les droits d'auteur.
La réutilisation de ces documents notamment textuels, sonores, vidéo ou autres est donc, par principe, strictement interdite sans l'accord exprès de TELIDE S.A.
******************************************************************************************/

/*function fusionne(indice,sform,sChpName)
{
	
alert('LB');

 var toutCoche 	= 1;
 var pos =0;
 
 var nbElem=eval('document.'+sform+'.elements.length');
alert(nbElem);
 for (i=0; i < nbElem; i++) {
  if (eval('document.'+sform+'.elements[i].name.substr(0,7)')==sChpName.substr(0,7)) {
   //alert(eval('document.'+sform+'.elements[i].name.substr(0,7)'));
   if (eval('document.'+sform+'.elements[i].name')==sChpName) { pos= i; }
   eval('document.'+sform+'.elements[i].checked=0');
	}
 }
alert("toto");
 document.getElementById('IDPROP').value  	= eval('document.'+sform+'.elements[pos].value.substr(0,19)');
 document.getElementById('libelle').value  	= eval('document.'+sform+'.elements[pos].value.substring(19)');
 eval('document.'+sform+'.elements[pos].checked=1');
}*/

if(window.XMLHttpRequest) // Firefox
  http = new XMLHttpRequest();
else if(window.ActiveXObject) // Internet Explorer
 	http = new ActiveXObject("Microsoft.XMLHTTP");
var Coordx = 0; 
var Coordy = 0;


function Remplace(expr,a,b) {
     var i=0
      while (i!=-1) {
         i=expr.indexOf(a,i);
         if (i>=0) {
            expr=expr.substring(0,i)+b+expr.substring(i+a.length);
            i+=b.length;
         }
      }
      return expr
   }



function show(menu)
{
 if (document.all [menu].style.display == 'none')
 {document.all [menu].style.display='';
 } else {
  document.all [menu].style.display='none';
 }
}

function popBubble (o,url)
{
 	var PositionElm=0;
 
	document.getElementById(o).style.visibility = "hidden";
	http.open('get',url+"&nocache=" + Math.random(), false);
	http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset={CHAR_SET}');
	http.send(null);
	if(http.readyState == 4) 
	{	
		document.getElementById(o).innerHTML=http.responseText;
	}
	else
		return;
	if (http.responseText=="") return;
	document.getElementById(o).style.top = Coordy + document.body.scrollTop;
	PositionElm=parseInt(document.getElementById(o).style.top.substring(0,document.getElementById(o).style.top.indexOf('px')));
	if ((PositionElm+document.getElementById(o).clientHeight-document.body.scrollTop)>document.body.clientHeight)
		document.getElementById(o).style.top=document.body.clientHeight-document.getElementById(o).clientHeight+document.body.scrollTop-20;
	
	if (screen.width-Coordx >= 600)
	{
		document.getElementById(o).style.left = Coordx; 
	}
	else
	{
		document.getElementById(o).style.left = Coordx-260;
	}
	document.getElementById(o).style.visibility = "visible";
	if ((PositionElm+document.getElementById(o).clientHeight-document.body.scrollTop)>document.body.clientHeight)
		document.getElementById(o).style.top=document.body.clientHeight-document.getElementById(o).clientHeight+document.body.scrollTop-20;

}
function AffAide(sVar)
{
	popBubbleTxt ('aide',sVar,'aideCORPS','aideTITRE');
 
}
function popBubbleTxt (oGlob,IdPropMod,oText,oTitre)
{
 var PositionElm=0;
 
 	//alert('TXT'+IdPropMod);return;
 	
	if(document.getElementById('TXT'+IdPropMod).innerHTML == "") 
		return;
	
	document.getElementById(oText).innerHTML=document.getElementById('TXT'+IdPropMod).innerHTML;//+"\n EY="+document.getElementById(oGlob).style.top+"\nSourisX"+Coordy;
	document.getElementById(oTitre).innerHTML=document.getElementById('TTR'+IdPropMod).innerHTML;// + "PositionElmY="+PositionElmY+"<br>document.getElementById(oGlob).style.left"+document.getElementById(oGlob).style.left+"<br>document.body.scrollTop="+document.body.scrollTop;
		
 document.getElementById(oGlob).style.top = Coordy + document.body.scrollTop+20;
 //if (Coordy<(document.getElementById(oGlob).style.top-document.body.scrollTop))
 //document.getElementById(oGlob).style.left = Coordx + document.body.scrollLeft;
 
 PositionElmY=parseInt(document.getElementById(oGlob).style.top.substring(0,document.getElementById(oGlob).style.top.indexOf('px')));
 if ((PositionElmY+document.getElementById(oGlob).clientHeight)>(document.body.clientHeight+document.body.scrollTop))
 {
 	document.getElementById(oGlob).style.top=document.body.scrollTop+5;
 	if (Coordx>((document.body.clientWidth)/2))
 		document.getElementById(oGlob).style.left=document.body.scrollLeft;
	else
 		document.getElementById(oGlob).style.left = Coordx + document.body.scrollLeft;
 }
 else
	document.getElementById(oGlob).style.left = document.body.scrollLeft+((document.body.clientWidth-document.getElementById(oGlob).offsetWidth)/2);

/*if (document.getElementById(oGlob).style.top.substring(0,document.getElementById(oGlob).style.top.indexOf('px'))<(Coordy + document.body.scrollTop))
	document.getElementById(oGlob).style.top = Coordy + document.body.scrollTop+20;*/

PositionElmX=parseInt(document.getElementById(oGlob).style.left.substring(0,document.getElementById(oGlob).style.left.indexOf('px')));
if ((PositionElmX+document.getElementById(oGlob).clientWidth-document.body.scrollRight)>document.body.clientWidth)
 	document.getElementById(oGlob).style.left=document.body.clientWidth-document.getElementById(oGlob).clientWidth+document.body.scrollLeft;

if ((PositionElmX+document.getElementById(oGlob).clientWidth-document.body.scrollRight)>document.body.clientWidth)
 	document.getElementById(oGlob).style.left=document.body.clientWidth-document.getElementById(oGlob).clientWidth+document.body.scrollLeft;
/*if (document.getElementById(oGlob).style.left.substring(0,document.getElementById(oGlob).style.left.indexOf('px'))<(Coordx + document.body.scrollLeft))
	document.getElementById(oGlob).style.left = Coordx + document.body.scrollLeft;*/
 document.getElementById(oGlob).style.visibility = "visible";


}
function popBubbleTxtDirect (oGlob,sText,sTitre,oText,oTitre)
{
 var PositionElm=0;
 //alert(sText+'\n'+sTitre);
 document.getElementById(oText).innerHTML=sText;
 document.getElementById(oTitre).innerHTML=sTitre;
 document.getElementById(oGlob).style.top = Coordy + document.body.scrollTop+10;
 document.getElementById(oGlob).style.left = Coordx + document.body.scrollLeft+10;

 PositionElmY=parseInt(document.getElementById(oGlob).style.top.substring(0,document.getElementById(oGlob).style.top.indexOf('px')));
 PositionElmX=parseInt(document.getElementById(oGlob).style.left.substring(0,document.getElementById(oGlob).style.left.indexOf('px')));
 
 if ((PositionElmY+document.getElementById(oGlob).clientHeight-document.body.scrollTop)>document.body.clientHeight)
 	document.getElementById(oGlob).style.top=document.body.clientHeight-document.getElementById(oGlob).clientHeight+document.body.scrollTop-5;
if ((PositionElmX+document.getElementById(oGlob).clientWidth-document.body.scrollLeft)>document.body.clientWidth)
 	document.getElementById(oGlob).style.left=document.body.clientWidth-document.getElementById(oGlob).clientWidth+document.body.scrollLeft-5;

//PositionElmY=parseInt(document.getElementById(oGlob).style.left.substring(0,document.getElementById(oGlob).style.left.indexOf('px')));

if ((PositionElmY+document.getElementById(oGlob).clientWidth-document.body.scrollRight)>document.body.clientWidth)
 	document.getElementById(oGlob).style.left=document.body.clientWidth-document.getElementById(oGlob).clientWidth+document.body.scrollLeft;

if (document.getElementById(oGlob).style.top.substring(0,document.getElementById(oGlob).style.top.indexOf('px'))<(Coordy + document.body.scrollTop))
	document.getElementById(oGlob).style.top = Coordy + document.body.scrollTop+10;
 document.getElementById(oGlob).style.visibility = "visible";


}
function cocheAll(idCoche,id,sform) {
	var nbElem=eval('document.'+sform+'.elements.length');
	
	if(document.getElementById(idCoche+'total').checked == true) {
		for (i=0; i < nbElem; i++) {eval('document.'+sform+'.elements[i].checked = 1;');}
		TOTAL = id;
	} else {
		for (i=0; i < nbElem; i++)  {eval('document.'+sform+'.elements[i].checked = 0;');}
		TOTAL ='';
	}
}


function coche(idCoche,id)
{
document.getElementById(idCoche+'total').checked = 0;	
	
if (TOTAL.lastIndexOf(id)==-1) { 
	TOTAL +=id+'\t';
  } else {
  	TOTAL =Remplace(TOTAL,id+'\t','')
 } 
}

function DecocheAll(sform) {
	var nbElem=eval('document.'+sform+'.elements.length');
		
	for (i=0; i < nbElem; i++)  {eval('document.'+sform+'.elements[i].checked = 0;');}
	TOTAL ='';
}

function cocheUneSeule(idCoche, sform)
{
//alert("je suis dans le javascript");
//alert(idCoche+"-"+sform);

var nbElem=eval('document.'+sform+'.elements.length');
var icheck=document.getElementById(idCoche).checked;
//alert("nbelement"+nbElem);
for (i=0; i < nbElem; i++)  {
	if (document.getElementById(idCoche)) {
	eval('document.'+sform+'.elements[i].checked = 0;');
	}
}

if (icheck==1) document.getElementById(idCoche).checked = 1;	
}



function killBubble(o)
{
  document.getElementById(o).src="";
 document.getElementById(o).style.visibility = "hidden";
}

function ifResize(o,val)
{
 o.style.height = val ;
 o.style.width = 450;
}

function coord(evt)
{ 
 //alert(evt);
 Coordx = mousex(evt)+10; 
 Coordy = mousey(evt)+10;  
} 

function mousex(evt)
{
	 if( !evt ) evt = window.event;
   return evt.clientX ;
   /*+ (document.documentElement.scrollLeft || document.body.scrollLeft);*/
}


function mousey(evt)
{
	 if( !evt ) evt = window.event;
   return evt.clientY ;
   /*+ (document.documentElement.scrollTop || document.body.scrollTop);*/
}


function gereMenuCarte(idMnu, Action)
 {
  var libAffiche = 'Afficher';
  var libMasque  = 'Masquer';
  /*if (Action == 'A')
  {
   //parent.droite.document.all [idMnu].style.display = '';
   document.getElementById(idMnu).style.display = '';
   document.getElementById(idMnu+"A").innerHTML = "<font face='arial' size='0.8' color='#000066'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>"+libAffiche+"</b></font>";
   document.getElementById(idMnu+"M").innerHTML = "<font face='arial' size='0.8' color='#000000'><a href='javascript:gereMenuCarte(\""+idMnu+"\", \"M\")'>"+libMasque+"</a></font>";
   */
  
   var sURL=document.location.href;
   if (sURL.indexOf("#", 0)!=-1) {document.location=sURL.substr(0,sURL.indexOf("#", 0))+"#section_"+idMnu;} 
   	else {document.location=sURL+"#section_"+idMnu;}
  /*
  }
  else
  {
   //parent.droite.document.all [idMnu].style.display = 'none';
   document.getElementById(idMnu).style.display = 'none';
   document.getElementById(idMnu+"M").innerHTML = "<font face='arial' size='0.8' color='#000066'><b>"+libMasque+"</b></font>";
   document.getElementById(idMnu+"A").innerHTML = "<font face='arial' size='0.8' color='#000000'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:gereMenuCarte(\""+idMnu+"\", \"A\")'>"+libAffiche+"</a></font>";
  }*/
 }



function gereOnglet(Origine,sessionId){
 var libAccueil	= 'Accueil';
 var libAide 	= 'Aide';
 var libCarte 	= 'CIPRP';
 var libLstVal	= 'Listes d\'informations';
 var libParam	= 'Paramétrage';
 switch(Origine)
 {
  case "A":
   document.getElementById('onglet').innerHTML = "<table class='cachee' cellpadding='0' cellspacing='0'><tr><td class='iongl'><img src='./images/selbg.gif'></TD><td class='bgongls'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('A','"+sessionId+"')\" target='_self'>"+libAccueil+"</a>&nbsp</font><br/></td><td class='iongl'><img src='./images/selg.gif'></TD><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('C','"+sessionId+"')\" target='_self'>"+libCarte+"</a>&nbsp;</font><br/></td><td class='iongl'><img src='./images/bord1.gif'></td><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('L','"+sessionId+"')\" target='_self'>"+libLstVal+"</a>&nbsp;</font></td><td class='iongl' ><img src='./images/bord1.gif'></td><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('P','"+sessionId+"')\" target='_self'>"+libParam+"</a>&nbsp;</font></td><td class='iongl' ><img src='./images/bordd.gif'></td></tr></table>";
   parent.contenu.location.href = 'accueil.htm?sessionId='+sessionId;
   parent.pied.location.href = 'piedaccueil.htm';
   break;
  case "C":
   document.getElementById('onglet').innerHTML = "<table class='cachee' cellpadding='0' cellspacing='0'><tr><td class='iongl'><img src='./images/bordg.gif'></TD><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('A','"+sessionId+"')\" target='_self'>"+libAccueil+"</a>&nbsp</font><br/></td><td class='iongl'><img src='./images/seld.gif'></TD><td class='bgongls'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('C','"+sessionId+"')\" target='_self'>"+libCarte+"</a>&nbsp;</font><br/></td><td class='iongl'><img src='./images/selg.gif'> </td><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('L','"+sessionId+"')\" target='_self'>"+libLstVal+"</a>&nbsp;</font></td><td class='iongl' ><img src='./images/bord1.gif'></td><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('P','"+sessionId+"')\" target='_self'>"+libParam+"</a>&nbsp;</font></td><td class='iongl' ><img src='./images/bordd.gif'></td></tr></table>";
   parent.contenu.location.href = 'fr_carte.php?sessionId='+sessionId;
   parent.pied.location.href = 'pied.htm';
   break;
  case "L":
   document.getElementById('onglet').innerHTML = "<table class='cachee' cellpadding='0' cellspacing='0'><tr><td class='iongl'><img src='./images/bordg.gif'></TD><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('A','"+sessionId+"')\" target='_self'>"+libAccueil+"</a>&nbsp</font><br/></td><td class='iongl'><img src='./images/bord1.gif'></TD><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('C','"+sessionId+"')\" target='_self'>"+libCarte+"</a>&nbsp;</font><br/></td><td class='iongl'><img src='./images/seld.gif'> </td><td class='bgongls'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('L','"+sessionId+"')\" target='_self'>"+libLstVal+"</a>&nbsp;</font></td><td class='iongl' ><img src='./images/selg.gif'></td><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('P','"+sessionId+"')\" target='_self'>"+libParam+"</a>&nbsp;</font></td><td class='iongl' ><img src='./images/bordd.gif'></td></tr></table>";
   parent.contenu.location.href='fr_lst_val.php?sessionId='+sessionId;
   parent.pied.location.href='piedsimple.htm';
   break;
  case "P":
   document.getElementById('onglet').innerHTML = "<table class='cachee' cellpadding='0' cellspacing='0'><tr><td class='iongl'><img src='./images/bordg.gif'></TD><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('A','"+sessionId+"')\" target='_self'>"+libAccueil+"</a>&nbsp</font><br/></td><td class='iongl'><img src='./images/bord1.gif'></TD><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('C','"+sessionId+"')\" target='_self'>"+libCarte+"</a>&nbsp;</font><br/></td><td class='iongl'><img src='./images/bord1.gif'> </td><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('L','"+sessionId+"')\" target='_self'>"+libLstVal+"</a>&nbsp;</font></td><td class='iongl' ><img src='./images/seld.gif'></td><td class='bgongls'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('P','"+sessionId+"')\" target='_self'>"+libParam+"</a>&nbsp;</font></td><td class='iongl' ><img src='./images/selbd.gif'></td></tr></table>";
   parent.contenu.location.href='fr_param.php?sessionId='+sessionId;
   parent.pied.location.href='piedsimple.htm';
   break;
  case "?":
   document.getElementById('onglet').innerHTML = "<table class='cachee' cellpadding='0' cellspacing='0'><tr><td class='iongl'><img src='./images/bordg.gif'></TD><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('A','"+sessionId+"')\" target='_self'>"+libAccueil+"</a>&nbsp</font><br/></td><td class='iongl'><img src='./images/bord1.gif'></TD><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('C','"+sessionId+"')\" target='_self'>"+libCarte+"</a>&nbsp;</font><br/></td><td class='iongl'><img src='./images/bord1.gif'></td><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('L','"+sessionId+"')\" target='_self'>"+libLstVal+"</a>&nbsp;</font></td><td class='iongl' ><img src='./images/bord1.gif'></td><td class='bgongl'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('P','"+sessionId+"')\" target='_self'>"+libParam+"</a>&nbsp;</font></td><td class='iongl' ><img src='./images/seld.gif'></td><td class='bgongls'><FONT size='2'>&nbsp;<a href=\"javascript:gereOnglet('P')\" target='_self'>"+libAide+"</a>&nbsp;</font></td><td class='iongl' ><img src='./images/selbd.gif'></td></tr></table>";
   parent.contenu.location.href='aideGen.htm';
   parent.pied.location.href='vide.htm';
   break;
  default: 
   alert("Erreur");
 }
}



