<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d)
{ //v4.0
	var p,i,x;
	if(!d)
		d=document;
	if( (p=n.indexOf("?")) > 0 && parent.frames.length)
	{
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if( !(x=d[n]) && d.all)
	{
		x=d.all[n];

	}
	for (i=0; !x && i<d.forms.length;i++)
		x=d.forms[i][n];
	for(i=0; !x && d.layers && i<d.layers.length;i++)
		x=MM_findObj(n,d.layers[i].document);
	if(!x && document.getElementById)
		x=document.getElementById(n);
	return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// amélio ECRITEL-I
function verifyemail_check(str)
{ 
        if(!str.match(/^[\w]{1}[\w\.\-_]*@[\w]{1}[\w\-_\.]*\.[\w]{2,6}$/i)) { 
            return false; 
        } else { 
            return true; 
        } 
} 

// amélio ECRITEL-I
function IsDigit(c)		//	teste si le caractere c est un chiffre ou non
{
	var test = "" + c;
	if (test == "0" || test == "1" || test == "2" || test == "3" || test == "4" || test == "5" 
			|| test == "6" || test == "7" || test == "8" || test == "9")
	{
		return true;
	}
	return false;
}

// amélio ECRITEL-I
function IsStringDigit(str)		//	teste si la chaine str est composee de chiffres
{
	var test = "" + str;		//	cast to string
	for (var i = 0; i < test.length; i++)
	{
		var ch = test.substring(i, i+1);
		if (IsDigit(ch) == false)
		{
			return false;
		}
	}
	return true;
}

function MM_validateForm()
{ //v4.0
	var i,j,p,q,t,s,nm,test,num,min,max,champ,pws,errors='',args=MM_validateForm.arguments;
	for (i=0; i<(args.length-2); i+=3)
	{ 
		test=args[i+2];
		val=MM_findObj(args[i]);
		if (val)
		{
			t=val.type;
			s=val.length;
			if(!t && s)
				nm=args[i];
			else
				nm=val.name;
			switch (nm)
			{
				case "nom" :
					champ = "Le nom";
					break;
				case "prenom" :
					champ = "Le prénom";
					break;
				case "id_profession" :
					champ = "La profession";
					break;
				case "fonction" :
					champ = "La fonction";
					break;
				case "etab_soc" :
					champ = "L\'établissement ou la société";
					break;
				case "mode_pra" :
					champ = "Le mode de pratique";
					break;
				case "email" :
					champ = "L\'email";
					break;
				case "cno" :
					champ = "Le numéro C.N.O. ou ADELI";
					break;
				case "adresse" :
					champ = "L\'adresse";
					break;
				case "code_postal" :
					champ = "Le code postal";
					break;	
				case "localite" :
					champ = "La localité";
					break;
				case "login" :
					champ = "L\'identifiant";
					break;
				case "password" :
					pws = val.value;
					champ = "Le mot de passe";
					break;
				case "password_confirm" :
					champ = "La confirmation du mot de passe";
					test = "ConfPass";
					break;
				default :
					champ = nm;
			}

			if(!t && s && test == 'R')
			{
				var trouve=false;
				for(j=0; j< s; j++)
				{
					if( val[j].checked == true)
					{
						trouve = true;
						break;
					}
				}
				if(!trouve)
					errors += '- '+champ+' est obligatoire.\n';
			}
			else if ( (val=val.value) != "")
			{
				if (test.indexOf('ConfPass') !== -1)
				{
					if(val != pws)
					{
						errors += "- Le mot de passe et sa confirmation doivent être identiques.";
					}
				}
				else if ( test.indexOf('isEmail') != -1)
				{
					if( !verifyemail_check(val) ) errors+='- '+champ+' n \'est pas valide.\n';
				}
				else if (test != 'R')
				{
					if (isNaN(val)) errors+='- '+champ+' doit contenir un nombre.\n';
					if (test.indexOf('inRange') != -1)
					{
						p=test.indexOf(':');
						min=test.substring(8,p); max=test.substring(p+1);
						if (val<min || max<val) errors+='- '+champ+' doit contenir un nombre entre '+min+' et '+max+'.\n';
					}
				}
			}
			else if (test.charAt(0) == 'R')
				errors += '- '+champ+' est obligatoire.\n';
		}	  
	}
	if (errors) alert('Les champs suivants sont incorrects / non-renseignés:\n'+errors);
	document.MM_returnValue = (errors == '');
}

function reset_form(formula)
{
	formula.reset();
}
//-->