//****************************************************************************//
//  NE PAS SAISIR LES BALISES JAVASCRIPT
//****************************************************************************//
var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

//******** CHANGEMENT COULEUR CELLULE
function cellOver(cell,color1,color2){
	if(color2 != ""){
		cell.style.color = color2;
	}
	if(color1 != ""){
		cell.style.background = color1;
	}
	return true;
}

function Change_objet(nObjet,nContenu) {
	  // nObjet = le nom de l'objet
	  // nContenu = Le contenu affiché dans l'objet
	
	  if (ns4) {
		document.eval(nObjet).document.write(nContenu);
		document.eval(nObjet).document.close();
	  }
	  else if (ns6) {
		document.getElementById(nObjet).innerHTML = nContenu;
	  }
	  else if (ie4) {
		eval(nObjet).innerHTML = nContenu;
	  }
}

function masqueSaisieChaineNum(obj, masque) {
  var ch = obj.value
  var tmp = ""
  var j = 0
  ch.toString()
  
  if (window.event.keyCode != 37 && window.event.keyCode != 39 && window.event.type != "keydown" && window.event.keyCode != 8 && window.event.keyCode != 46) {
    
		if (window.event.type == "keyup") {
		  
		      // reconstitution de la chaine ss espace ni lettre
			  for (i=0; i<ch.length; i++) {
					if (!isNaN(ch.charAt(i)) && ch.charAt(i) != " "){
						tmp += ch.charAt(i)
					}
			  }
			  
		      // vidage de la chaine
			  ch = ""
		  
		  	  // parsage
			  for (i=0; i<masque.length; i++) {
					if (masque.charAt(i)  == "0") { 
						  if (tmp.charAt(j) != "" ) {
							ch += tmp.charAt(j)
							j++
						  }else{
							ch += ""
						  }
					}else if(tmp.charAt(i) != ""){ 
						ch += masque.charAt(i)
					}
			  }
			  
		}
	  
		obj.value = ch
  }
  
}

// ******* OUVERTURE D'UNE POPup CENTREE
function PopupCentrer(page,nom,largeur,hauteur,options) {

	var top=(screen.height-hauteur)/2;
	var left=(screen.width-largeur)/2;
	window.open(page,nom,"top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}
//appelle de la fonction :
//<a HREF='javascript:PopupCentrer("popup.php",".$largeur.",".$hauteur.","menubar=no,scrollbars=no,statusbar=no")'>lien</a>

// ******* redirection sur l'url spécifiée
function redirection(url){
	window.location = url;
	//<meta http-equiv="refresh" content=0;URL='.$url.'>
}

//******** demande de confirmation et redirection
function confirmation(conf,add){
	if (confirm(conf)){	
		window.location=add;
	}
}

//*********************************************************************************************
//  AFFICHE / CACHE UN BLOC DIV, TD, TR,...
//*********************************************************************************************
function swapLayer(objMenu,objImage,pref){

   var myElement = document.getElementById(objMenu,objImage); 
   if (myElement.style.display == "none"){
       myElement.style.display = "";
	   //if(objImage != ""){
       		objImage.src = pref+"images/moins.gif";
	   //}
   
   }else{
       myElement.style.display = "none";
	   //if(objImage != ""){
       		objImage.src = pref+"images/plus.gif";
	   //}
   }
}
//*********************************************************************************************
