
<!-- 

 
  //retourne une valeur à partir d'une chaine ( separateur: point ou virgule )  
  function valeur(str){ 
    var pos;
	if (str=="") return 0;
	pos=str.indexOf(",");
	if (pos >= 0) {
	  str=str.substring(0,pos)+"."+str.substring(pos+1,str.length);
	}  
	return parseFloat(str);	
  }
  
  //retourne une chaine avec 2 decimales à partir d'une valeur 
  function str2dec(x){
    var str,pos,man,dec,i,n;
	n=(Math.round(x*100))/100;
	str=n.toString();
	man=str;
	dec="";	
    pos=str.indexOf(".");
	if (pos >= 0) {
	  man=str.substring(0,pos)
	  dec=str.substring(pos+1,str.length);
	}	
	if (dec.length<2){
	  for( i=0; i<=2-dec.length; i++){
	    dec=dec+"0";
	  }
	}  
	str=man+","+dec;
    return str;
  }
	
	//Enleve les blancs d'une chaine
	function sansBlanc(chaine) {
	var str, pos;
	pos=1;
	str = chaine;
	while ( pos>=0 ) {
	  pos=str.indexOf(" ");
	  
	  if (pos<0) {return str;}
	  str=str.substring(0,pos)+str.substring (pos+1,str.length);
	}
	}
	
	function remplace(expr,a,b) { // remplace dans une chaine "expr" la chaine "a" par la chaine "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 isEmail(s){ // return true si la chaine est  une adresse e-mail valide
	  var mail;		
		var reponse;
		
		mail = /^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]+@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-ç])+$/;		
	  reponse=mail.test(s);		
		return reponse;
	}
	
	function isNum(s){ // return true si la chaine s ne contient que des chiffres
	  var c;		
	  for ( var i = 0; i < s.length; i++){
		  c = s.charAt(i);			
			if ((c < '0') || (c > '9')) return false;
		}
		return true;
	}
	
	function isBlank(s){ // return true si la chaine s ne contient que des espaces blancs
	  var c;		
	  for ( var i = 0; i < s.length; i++){
		  c = s.charAt(i);			
			if ((c != ' ') && (s.charCodeAt(i) != 13) && (s.charCodeAt(i) != 10) && (c != '')) return false;
		}
		return true;
	}
	
	function estVide(c) { // return true si le champ c est vide ou blanc
	  if ((c == null)||(c == "")||(isBlank(c))) return true;
		else return false;
	}   
  
  
 
//-->
