function conf(mot) {
if (confirm(mot))
return(true);
return(false);
}

function poeSeparOnLeft(name) {
  if(document.images) {
    obj = document.images[name];
    var src = obj.src;
    var newsrc = src.replace(/_off/,"_left");
    obj.src = newsrc;
  }
}

function poeSeparOnRight(name) {
  if(document.images) {
    obj = document.images[name];
    var src = obj.src;
    var newsrc = src.replace(/_off/,"_right");
    obj.src = newsrc;
  }
}

function poeSeparOff(name) {
  if(document.images) {
    obj = document.images[name];
    var src =obj.src;
    var newsrc = src.replace(/_left/,"_off");
    newsrc = newsrc.replace(/_right/,"_off");
    obj.src = newsrc;
  }
}

function poePreloadImgOn() {
  if(document.images) {
    this.length=poePreloadImgOn.arguments.length;
    for(var i=0; i<this.length;i++) {
      this [i+1]=new Image ();
      this [i+1].src = poePreloadImgOn.arguments[i];
    }
  }
}

function poeImgOn(name) {
  if(document.images) {
    obj = document.images[name];
    var src = obj.src;
    var newsrc = src.replace(/_off/,"_on");
    obj.src = newsrc;
  }
}

function poeImgOff(name) {
  if(document.images) {
    obj = document.images[name];
    var src =obj.src;
    var newsrc = src.replace(/_on/,"_off");
    obj.src = newsrc;
  }
}

function poeImgOffCustom(name) {
if (document.rollover.field.value != name) {
  if(document.images) {
    obj = document.images[name];
    var src =obj.src;
    var newsrc = src.replace(/_on/,"_off");
    obj.src = newsrc;
  }
}
}


//--------------------------------------------------------------------------------
//Nom        :  Ouverture d'une POPUP 
//Paramètres :  URL, Nom de la fenêtre, Largeur, Hauteur en pixels, 
//              avec ou sans barre de définlement (yes, no)
//              avec possibilité ou non de rediemntionner la fenêtre (yes, no)
//Retour     :  
//Objectif   :  Renvoye vrai si l'expression est correcte
//-------------------------------------------------------------------------------- 

function winOpen(url,name,w,h,scroll,resize) {

var tailleecranX=parseInt(screen.width);
var tailleecranY=parseInt(screen.height);
var nameNav = navigator.appName ; 

positionX=tailleecranX-w;
positionX=Math.round(positionX/2);
positionY=tailleecranY-h;
positionY=Math.round(positionY/2);

if (nameNav == 'Netscape') { 
  chaine = 'width='+w+',height='+h+',resizable='+resize+',scrollbars='+scroll+',screenY='+positionY+',screenX=' + positionX;
} 
else if (nameNav == 'Microsoft Internet Explorer') { 
  chaine = 'width='+w+',height='+h+',resizable='+resize+',scrollbars='+scroll+',top='+positionY+',left=' + positionX;
} 
else{
 // Autre navigateur 
 chaine = 'width='+w+',height='+h+',resizable='+resize+',scrollbars='+scroll+',top='+positionY+',left=' + positionX;
}

positionX=tailleecranX-w;
positionX=Math.round(positionX/2);
positionY=tailleecranY-h;
positionY=Math.round(positionY/2);
var laFenetre = window.open(url,name,chaine);
laFenetre.focus();
}


//--------------------------------------------------------------------------------
//Nom        :  ConvertirPointVirgule
//Paramètres :  chaine
//Retour     :  chaine convertie
//Objectif   :  convertit toutes les points d'une chaine en virgule
//-------------------------------------------------------------------------------- 
function ConvertirPointVirgule (inStr)
{
	return inStr.replace('.',',');
}
//--------------------------------------------------------------------------------
//Nom        :  ConvertirVirgulePoint 
//Paramètres :  chaine
//Retour     :  chaine convertie
//Objectif   :  convertit toutes les virgule d'une chaine en point
//-------------------------------------------------------------------------------- 
function ConvertirVirgulePoint (inStr)
{
	return inStr.replace(',','.');
}

//--------------------------------------------------------------------------------
//Nom        :  IsInteger 
//Paramètres :  nombre
//Retour     :  boolean
//Objectif   :  vérifie si un nombre est un entier
//-------------------------------------------------------------------------------- 
function IsInteger(inStr)
{
	pattern = /[^0-9]/;
	strInput = inStr.split(pattern);
	strInput = Trim(inStr).search(pattern);
	if(strInput!=-1)	
		return false;
	else
		return true;
}
//--------------------------------------------------------------------------------
//Nom        :  NombreDecimale
//Paramètres :  decimal , entier (nombre de décimale)
//Retour     :  nombre à decimale
//Objectif   :  renvoyer un chiffre avec un nombre de decimale désiré
//-------------------------------------------------------------------------------- 
function NombreDecimale(monchiffre, inDec)
{
	if ( (IsDec(monchiffre)) && (IsInteger(inDec)))
	{
		monchiffre = ConvertirVirgulePoint (monchiffre);
		var multiple = 	Math.pow(10,inDec);
		return (Math.round(monchiffre*multiple)/multiple);
	}
	else
		return "NOK";
}
//--------------------------------------------------------------------------------
//Nom        :  Puissance
//Paramètres :  nombre , entier
//Retour     :  chaine
//Objectif   :  puissance d'un chiffre
//-------------------------------------------------------------------------------- 
function Puissance(monchiffre, exposant)
{
	if ((IsDec(monchiffre)) && (IsInteger(exposant)))
	{
		return Math.pow(monchiffre, exposant);
	}
	else
		return "NOK";	
}
//--------------------------------------------------------------------------------
//Nom        :  IsIntegerInput  
//Paramètres :  objet Input
//Retour     :  booléen
//Objectif   :  vérifie si un nombre est un entier
//-------------------------------------------------------------------------------- 
function IsIntegerInput(objet)
{
	if (!(IsInteger(objet.value))) 
		{
			return true;
		} 
	else 
		{
			alert("Vous devez saisir un entier pour " + objet.name);
			objet.focus();
			objet.value="";
			return false;
		}
}
//--------------------------------------------------------------------------------
//Nom        :  IsDec 
//Paramètres :  chaine 
//Retour     :  booléen
//Objectif   :  vérifie si un nombre est un décimal (ou entier)
//-------------------------------------------------------------------------------- 
function IsDec(inStr)
{
var num;
var strInput;
var pattern;

	inStr = ConvertirVirgulePoint (inStr);
	pattern = /[^0-9|^\.]/;
	strInput = inStr.search(pattern);
	
	if(strInput != -1)
		return false;
	else
	{
		pattern =/\./;
		strInput = inStr.split(pattern);
		if(strInput.length > 2 )
			return false;
		else
		{		
			num = parseFloat(inStr);
			if(isNaN(num)) 
				return false;
			else 
				return true;
		}
	}	
}

//--------------------------------------------------------------------------------
//Nom        :  IsDecimal imal
//Paramètres :  chaine variable, longueur et nb decimales 
//Retour     :  booléen
//Objectif   :  vérifie si un nombre est un décimal 
//-------------------------------------------------------------------------------- 
function IsDecimal(variable,longueur,precision) {

    flag = true;
    var tmp_val = variable;
    // Vérifie la numérotation avec un "." comme séparateur
    if(variable.indexOf(',')!=-1)
    {
       p       = ',';
      variable  = tmp_val.replace(p, '\.');        
    }
  
    // Vérifie qu'il s'agit d'un nombre décimal
  
    if (!parseFloat(variable)) {
        flag = false;    
    }
    else
    {
       if(variable.indexOf('.')!=-1)
      {    
        var point = variable.indexOf('.');
        var temp = variable.substring(0,point);
       
        //test precision
        if(temp.length-1 > precision)
          {         
            flag = false;
          }
        }   
        //test longueur
          if(variable.length-1 > longueur)
          {
            flag = false;
          }
         
    }
    return flag;
}


//--------------------------------------------------------------------------------
//Nom        :  ConvertirVirgulePoint 
//Paramètres :  chaine
//Retour     :  chaine convertie
//Objectif   :  convertit toutes les virgule d'une chaine en point
//-------------------------------------------------------------------------------- 
function ConvertirVirgulePoint (inStr)
{
	return inStr.replace(',','.');
}

//--------------------------------------------------------------------------------
//Nom        :  isFormatCorrect
//Paramètres :  chaine, taille max de la partie entière, taille max de la 
//              partie décimale.
//Retour     :  0 ==> Anomalie, 1 ==> Le format de la donnée est conforme
//Objectif   :  controle le format 
//-------------------------------------------------------------------------------- 
function isFormatCorrect(variable,nbEntier,nbVirgule)
{
  var strInput;
  var erreur = 0;
  
  // Conversion des ',' en '.'
  variable = ConvertirVirgulePoint (variable);

  if(variable.indexOf('.',0)==-1) 
  {
    // La variable ne contient pas de '.'
    if (isNaN(variable)) {
        erreur = -1;
        return erreur;
    }
    if(variable.length>nbEntier)
    {
      erreur = -1;
    }
  }
  else{

    // Le '.' est trouvé
    if(variable.indexOf('.') != variable.lastIndexOf('.')) 
        return -1;
    strInput = variable.split('.');
    var ent = strInput[0];
    var dec = strInput[1];

    if (isNaN(ent) || isNaN(dec)) {
        erreur = -1;
        return erreur;
    }

   if(ent.length>nbEntier || ent.length==0 )
      erreur = -1;
   if(dec.length>nbVirgule)
      erreur = -1;

   if((dec.length + ent.length) > (nbEntier+ nbVirgule))
      erreur = -1;

   }
   return  erreur ;
}