// Gestion de l'editeur WYSIWING //
function editeur(path, formulaire, champs)
{	
	//window.open(path+"commun/editeur/ed.php?ParentFormName="+formulaire+"&ParentTextareaName="+champs, "editeur", "width=720,height=450,resizable=yes");
	//alert(path);
	window.open(path+"editeur/editeur.php?ParentFormName="+formulaire+"&ParentTextareaName="+champs, "editeur", "width=720,height=450,resizable=yes");
	
}
//--- FONCTION DE COPIE DANS LE PRESSE PAPIER --//
function copy2Clipboard(obj)
{
  	var textRange = document.body.createTextRange();
  	textRange.moveToElementText(obj);
  	textRange.execCommand("Copy");
}
//--- AFFICHER / CACHER UNE ZONE ---//
function affiche_ON_OFF(sChamp, sStatut) 
{ 
  isIE = (document.all) 
  isNN6 = (!isIE) && (document.getElementById)
  if (isIE) sElemChamp = document.all[sChamp];
  if (isNN6) sElemChamp = document.getElementById(sChamp);
  
  if(sStatut=='ON'){sElemChamp.style.display='';} 
  if(sStatut=='OFF'){sElemChamp.style.display='none';} 
  //if(sStatut=='ON'){stVisible.visibility='visible';} 
  //if(sStatut=='OFF'){stVisible.visibility='hidden';} 
}
//--- ACTIVER / DESCTIVER UNE ZONE ---//
function active_ON_OFF(sForm, sChamp, sStatut) 
{   
  if(sChamp.indexOf("|")>0)
  {
  	tabChamp = sChamp.split("|");
  	for(iTab = 0; iTab<tabChamp.length; iTab++)
  	{
  		if(sStatut=='ON'){eval('document.' + sForm + '.'+ tabChamp[iTab] + '.disabled = false;');} 
  		if(sStatut=='OFF'){eval('document.' + sForm + '.'+ tabChamp[iTab] + '.disabled = true;');}   
  	}
  }else{
  	if(sStatut=='ON'){eval('document.' + sForm+'.'+sChamp+'.disabled = false;');} 
  	if(sStatut=='OFF'){eval('document.' + sForm+'.'+sChamp+'.disabled = true;');}   
  }
}
//--- ACTIVER / DESCTIVER UNE ZONE AVEC UN ID ---//
function active_checkBox_ON_OFF(sForm, sChamp, sStatut) 
{   
  if(sChamp.indexOf("|")>0)
  {
  	tabChamp = sChamp.split("|");
  	for(iTab = 0; iTab<tabChamp.length; iTab++)
  	{  		
	 	if(sStatut=='ON'){eval('document.' + sForm + '.'+ tabChamp[iTab] + '.disabled = false;');} 
	 	if(sStatut=='OFF'){eval('document.' + sForm + '.'+ tabChamp[iTab] + '.disabled = true;');}   	 
  	}
  }else{  	
	  if(sStatut=='ON'){eval('document.' + sForm + '.' + sChamp + '.disabled = false;');} 
	  if(sStatut=='OFF'){eval('document.' + sForm + '.' + sChamp + '.disabled = true;');}   	
  }
}
// Fonction de verification d'email //
function is_email(email)
{		
   if(email!="")
   {	
	   var reg = /^[\w.-]+@[\w.-]+\.\w{1,4}$/
	   var reg2 = /[.@]{2,}/
	   return ((reg.exec(email)!=null) && (reg2.exec(email)==null))
	}else{return true;}		
}	
// Affichage d'une boite d'alerte proposant le choix oui/non avec un message en parametre
function confirmationAlert(url,msg) 
{res = confirm(msg);if(res) document.location.href = url;}   	
// Fonction générique d'ouverture de popup		
function openPopup(url,nom,largeur,hauteur,pStatus, pLocation, pMenu, pResizable, pToolbar, pScrollbar) 
{x = screen.width-largeur;if(x>0){x=x/2;}y = screen.height-hauteur;if(y>0){y=y/2;}
window.open(url,nom,"status="+pStatus+", location="+pLocation+", menubar="+pMenu+", resizable="+pResizable+", toolbar="+pToolbar+", scrollbars=="+pScrollbar+", width="+largeur+", Height="+hauteur+", left="+x+", top="+y);}   	
// Fonction générique d'ouverture de popup		
function openWin(url,nom,largeur,hauteur,pStatus, pLocation, pMenu, pResizable, pToolbar, pScrollbar) 
{x = screen.width-largeur;if(x>0){x=x/2;}y = screen.height-hauteur;if(y>0){y=y/2;}
window.open(url,nom,"status="+pStatus+", location="+pLocation+", menubar="+pMenu+", resizable="+pResizable+", toolbar="+pToolbar+", scrollbars=="+pScrollbar+", width="+largeur+", Height="+hauteur+", left="+x+", top="+y);}   	
// Fonction de mise en surbrillance d'une ligne ( ex : cas d'une liste )
function surbrillanceON(ligne, classe)
{ligne.className = classe;}  
// Fonction de désavtivation de la surbrillance d'une ligne ( ex : cas d'une liste ) 	
function surbrillanceOFF(ligne, classe)
{ligne.className = classe;}     
// Fonction de séléction en surbrillance d'une ligne ( ex : cas d'une liste ) 	
function surbrillanceSel(ligne, colorSel)   
{if(ligne.style.backgroundColor == colorSel){ligne.style.backgroundColor = '';}else{ligne.style.backgroundColor = colorSel;}}     	

function changeImage(nomFichier, elemImage)   		
{elemImage.src = nomFichier;}
   
function onoffdisplay(formulaire, tabChamp)//Affchiage-Désaffichage du bloc de recherche
{   	   				   		
if(document.getElementById("blocRecherche").style.display=="none")
{document.getElementById("blocRecherche").style.display = "";}else{document.getElementById("blocRecherche").style.display = "none";   			   			
for (i=0; i<tabChamp.length; i++)    				
{document.getElementById(tabChamp[i]).value = '';}  
document.forms[formulaire].submit();}}				
//************************** AFFICHAGE BULlE D'AIDE **************************//
var IB=new Object;
var posX=0;posY=0;
var xOffset=00;yOffset=20;
function AffBulle(texte) {
  var isOP=(navigator.userAgent.indexOf('Opera') != -1)?true:false;		
  if(isOP)
  {contenu="<TABLE border=0 cellspacing=0 cellpadding="+IB.NbPixel+"><TR bgcolor='"+IB.ColContour+"'><TD><TABLE border=0 cellpadding=2 cellspacing=0 bgcolor='"+IB.ColFond+"'><TR><TD><FONT size='-1' face='arial' color='"+IB.ColTexte+"'>"+texte+"</FONT></TD></TR></TABLE></TD></TR></TABLE>&nbsp;";}
  else{contenu="<TABLE border=0 cellspacing=0 cellpadding="+IB.NbPixel+"><TR bgcolor='"+IB.ColContour+"'><TD><TABLE border=0 cellpadding=8 cellspacing=0 bgcolor='"+IB.ColFond+"'><TR><TD nowrap><FONT size='-1' face='arial' color='"+IB.ColTexte+"'>"+texte+"</FONT></TD></TR></TABLE></TD></TR></TABLE>&nbsp;";}
  var finalPosX=posX-xOffset;
  if (finalPosX<0) finalPosX=0;
  if (document.layers) {document.layers["bulle"].document.write(contenu);document.layers["bulle"].document.close();document.layers["bulle"].top=posY+yOffset;document.layers["bulle"].left=finalPosX;document.layers["bulle"].visibility="show";}
  if (document.all) {bulle.innerHTML=contenu;document.all["bulle"].style.top=posY+yOffset;document.all["bulle"].style.left=finalPosX;document.all["bulle"].style.visibility="visible";}	  
 else if (document.getElementById) {document.getElementById("bulle").innerHTML=contenu;document.getElementById("bulle").style.top=posY+yOffset;document.getElementById("bulle").style.left=finalPosX;document.getElementById("bulle").style.visibility="visible";
 }}
function getMousePos(e) {
if (document.all) {
posX=event.x+document.body.scrollLeft;posY=event.y+document.body.scrollTop;
}else {posX=e.pageX;posY=e.pageY; }}
function HideBulle() {
if (document.layers) {document.layers["bulle"].visibility="hide";}
if (document.all) {document.all["bulle"].style.visibility="hidden";}
else if (document.getElementById){document.getElementById("bulle").style.visibility="hidden";}
}	
function InitBulle(ColTexte,ColFond,ColContour,NbPixel) {
IB.ColTexte=ColTexte;IB.ColFond=ColFond;IB.ColContour=ColContour;IB.NbPixel=NbPixel;
if (document.layers) {window.captureEvents(Event.MOUSEMOVE);window.onMouseMove=getMousePos;document.write("<LAYER name='bulle' top=0 left=0 visibility='hide' z-index=50></LAYER>");}
if (document.all) {document.write("<DIV id='bulle' style='position:absolute;top:0;left:0;visibility:hidden;z-index:50'></DIV>");document.onmousemove=getMousePos;}
else if (document.getElementById) {document.onmousemove=getMousePos;document.write("<DIV id='bulle' style='position:absolute;top:0;left:0;visibility:hidden;z-index:50'></DIV>");}}
//************************** FIN AFFICHAGE BULlE D'AIDE **************************//
//****************** FAUSSE POPUP ********************************************//	
function affPopup(hauteurOri, largeurOri, posXOri, posYOri, colorOmbre, titre, texteFenetre, couleurTexte, texteFondColor, tailleTexte, policeTexte, pathImage, classBordure, tailleBordure, hauteurTitre, nomImageBarre, nomChampAffPopup)
{
	//alert(Math.random());
if(hauteurOri==0){var hauteur = screen.height/3}else{var hauteur = hauteurOri};         	       
if(largeurOri==0){var largeur = screen.width/3}else{var largeur = largeurOri;}; 
if(posXOri==0){var posX = ((screen.width-largeur)/2) + 20}else{var posX = posXOri;};
if(posYOri==0){var posY = (screen.height-largeur)/2}else{var posY = posYOri;};	
createPopup(Math.random(), titre, largeur, hauteur, posX, posY, true,  '#FFFFFF' , texteFondColor , colorOmbre,  texteFenetre , couleurTexte  , tailleTexte , policeTexte, '#FFFFFF', pathImage, classBordure, tailleBordure, hauteurTitre, nomImageBarre, nomChampAffPopup);	
}
//****************** FIN FAUSSE POPUP ********************************************//			 
//****************** ROLLOVER IMAGES ***************************************************//
function rolloverImage(nomImage, valeurImage){eval(nomImage + ".src='" + valeurImage + "'");}
