<!--
	var http_request;

	function GetAtlasCode(ville,code)
	{
		var code_etat="";
		if (ville.indexOf('(')>0 && ville.indexOf(')')>0)
		{
			var p=ville.indexOf("(");
			var f=ville.indexOf(")");
			var tmp = ville.substr(0,p-1);
			code_etat = ville.substr(p+1,ville.length - f+1);
			ville = tmp;
		}
		if (window.XMLHttpRequest)
			http_request = new XMLHttpRequest();
		else
			http_request = new ActiveXObject("Microsoft.XMLHTTP");
		var script="httpatlas.php";
		var params="code="+code+"&ville="+ville;
		if (code_etat != '')
			params += "&code_etat="+code_etat;
		script = script + "?" + params;
		http_request.onreadystatechange = ResultVille;
		http_request.open('GET',script,true);
		http_request.setRequestHeader("Content-Type","text/html; charset=iso-8859-1");
		http_request.send(params);
	}

	function ResultVille()
	{
		if (http_request.readyState == 4)
		{
			if (http_request.status == 200)
			{
				var txt = http_request.responseText;
				if (txt!='Erreur')
				{
					var myForm = document.getElementById('saisie');
					myForm.atlas_code.value=txt;
					http_request="";
					return;
				}
				else
				{
					http_request="";
					return;
				}
			}
		}
	}

	function ZipVille(zip)
	{
		if (zip.length < 5)
			return;
		if (window.XMLHttpRequest)
			http_request = new XMLHttpRequest();
		else
			http_request = new ActiveXObject("Microsoft.XMLHTTP");
		var script="httpatlas.php";
		var params="zip="+zip;
		script = script + "?" + params;
		http_request.onreadystatechange = ResultZip;
		http_request.open('GET',script,true);
		http_request.setRequestHeader("Content-Type","text/html; charset=iso-8859-1");
		http_request.send(params);
	}
	function ResultZip()
	{
		if (http_request.readyState == 4)
		{
			if (http_request.status == 200)
			{
				var txt = http_request.responseText;
				if ((txt.substr(0,6) == 'Erreur') || (txt.substr(0,4) == "Rien"))
				{
					http_request="";
					return;
				}
				else if (txt!='')
				{
					if (txt.indexOf("|")!=-1)
					{
						var lst=txt.split("|");
						var html = "<select name='ville' id='ville' class='mvrbox1' onfocus=\"this.style.backgroundColor='black'\" onblur=\"this.style.backgroundColor='#8F7F8B'\">";
						for(var i=0;i<lst.length;i++)
							html += ("<option value='" + lst[i] + "'>"+lst[i]+"</option>");
						html += "</select>";
						var obj = document.getElementById('spancity');
						obj.innerHTML = html;
						document.saisie.ville.focus();
					}
					else
					{
						var obj = document.getElementById('spancity');
                              			var html = "<input name='ville' id='ville' value='" + txt + "' class='mvrbox' maxlength='50' type='text' onfocus=\"Input(this,1,0,'','')\" onblur=\"Input(this,0,2,'','')\" title=\"Ville\">";
						obj.innerHTML = html;
						// obj.value = txt;
					}
					http_request="";
				}
			}
		}
	}

	function Init()
	{
		var obj;
		From();
		obj = document.getElementById('jour');
		obj.setAttribute("autorise","0123456789");
		obj = document.getElementById('mois');
		obj.setAttribute("autorise","0123456789");
		obj = document.getElementById('annee');
		obj.setAttribute("autorise","0123456789");
		obj = document.getElementById('he');
		obj.setAttribute("autorise","0123456789");
		obj = document.getElementById('mi');
		obj.setAttribute("autorise","0123456789");
		obj = document.getElementById('zip_code');
		obj.setAttribute("autorise","0123456789");
		obj = document.getElementById('euro');
		obj.setAttribute("autorise","0123456789 ");
		obj = document.getElementById('mobile');
		obj.setAttribute("autorise","0123456789");
		obj = document.getElementById('phone');
		obj.setAttribute("autorise","0123456789");
	
		MM_preloadImages('mvr_pict/mvr_how_on.gif','mvr_pict/mvr_press_on.gif','mvr_pict/mvr_who_on.gif','mvr_pict/mentions_on.gif');
	
	}
	function Input(obj,flag,type,name,value)
	{
		if (flag)
		{
			obj.style.backgroundColor='black';
			obj.style.fontWeight='bold';
			obj.style.textAlign='left';
			if (value != '')
			{
				if (obj.value == value)
					obj.value='';
			}
		}
		else
		{
			obj.style.backgroundColor='#8F7F8B';
			obj.style.fontWeight='normal';
			if (type == 1)
			{
				var v = obj.value;
				v = v.toUpperCase();
				obj.value = v;
			}
			else if (type == 2)
			{
				var c,x;
				v = obj.value;
				v = v.toLowerCase();
				c = v.substr(0,1);
				c = c.toUpperCase();
				v = c + v.substr(1,v.length-1);
				x = v.lastIndexOf(" ");
				if (x < 0)
					x = v.lastIndexOf("-");
				if (x > 0)
				{
					x = x + 1;
					c = v.substr(x,1);
					c = c.toUpperCase();
					v = v.substr(0,x) + c + v.substr(x+1,v.length - x - 1);
				}
				obj.value = v;
			}
			else if (type == 3)
			{
				obj.style.textAlign='center';
			}
		}
	}

	function is_email(email)
	{
		var rec = /(^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@+([_a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]{2,200}\.[a-zA-Z]{2,6}$)/;
		var r = rec.test(email);
		return r;
	}

	function Envoyer()
	{
		document.saisie.submit();	
	}
	
	function Valider()
	{
		if (document.saisie.birth_town.value != "" && document.saisie.atlas_code.value=="")
		{
			var ville = document.saisie.birth_town.value;
			var i = document.saisie.birth_country.selectedIndex;
			var pays = document.saisie.birth_country[i].value;
			var lst=pays.split(":");
			var code=lst[0];
			GetAtlasCode(ville,code);
		}
		if (document.saisie.civility.selectedIndex == 0)
		{
			alert("Vous n'avez pas précisé votre civilité.");
			document.saisie.civility.focus();
			return;
		}
		if (document.saisie.lastname.value=='')
		{
			alert("Vous n'avez pas indiqué votre nom.");
			document.saisie.lastname.focus();
			return;
		}
		if (document.saisie.firstname.value=='')
		{
			alert("Vous n'avez pas indiqué votre prénom.");
			document.saisie.firstname.focus();
			return;
		}
		if (document.saisie.jour.value=='jour')
		{
			alert("Vous n'avez pas précisé votre jour de naissance.");
			document.saisie.jour.focus();
			return;
		}
		var j = document.saisie.jour.value;
		j = parseInt(j,10);
		if (j > 31 || j < 1)
		{
			alert("Votre jour de naissance est invalide.");
			document.saisie.jour.focus();
			return;
		}
		if (document.saisie.mois.value=='mois')
		{
			alert("Vous n'avez pas précisé votre mois de naissance.");
			document.saisie.mois.focus();
			return;
		}
		var m = document.saisie.mois.value;
		m = parseInt(m,10);
		if (m > 12 || m < 1)
		{
			alert("Votre mois de naissance est invalide.");
			document.saisie.mois.focus();
			return;
		}
		if (document.saisie.annee.value=='année')
		{
			alert("Vous n'avez pas précisé votre année de naissance.");
			document.saisie.annee.focus();
			return;
		}
		var a = document.saisie.annee.value;
		a = parseInt(a,10);
		if (a < 1900)
		{
			alert("Votre année de naissance est invalide.");
			document.saisie.annee.focus();
			return;
		}
		if (document.saisie.he.value != "heure" && (document.saisie.he.value < 0 || document.saisie.he.value > 23))
		{
			alert("L'heure de naissance que vous avez saisie est invalide");
			document.saisie.he.focus();
			return;
		}
		if (document.saisie.mi.value != "minute" && (document.saisie.mi.value > 59 || document.saisie.mi.value < 0))
		{
			alert("L'heure de naissance que vous avez saisie est invalide");
			document.saisie.mi.focus();
			return;
		}
		if (document.saisie.street.value == '' || document.saisie.street.value == "rue ou voie")
		{
			alert("Vous n'avez pas rempli le champs adresse.");
			document.saisie.street.focus();
			return;
		}
		if (document.saisie.zip_code.value=='')
		{
			alert("Vous n'avez pas indiqué votre code postal.");
			document.saisie.zip_code.focus();
			return;
		}
		if (document.saisie.zip_code.value.length != 5)
		{
			alert("Le code postal est invalide.") 
			document.saisie.zip_code.focus();
			return;
		}
	
		if (document.saisie.ville.value=='')
		{
			alert("Vous n'avez pas indiqué votre ville.");
			document.saisie.ville.focus();
			return;
		}
		if (document.saisie.email.value == "")
		{
			alert("Vous n'avez pas indiqué votre courriel.");
			document.saisie.email.focus();
			return;
		}
		if (document.saisie.email.value.length)
		{
			var email = document.saisie.email.value;
			if (!is_email(email))
			{
				alert("Le courriel que vous avez saisi est incorrect !");
				document.saisie.email.focus();
				return;
			}
		}
		if (document.saisie.email1.value == "")
		{
			alert("Vous n'avez pas confirmé votre courriel.");
			document.saisie.email1.focus();
			return;
		}
		if (document.saisie.email1.value != document.saisie.email.value)
		{
			alert("Vous courriel de confirmation est différent de votre premier courriel.");
			document.saisie.email1.focus();
			return;
		}
		setTimeout(Envoyer,900);
	}
	
	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.01
	  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 && d.getElementById) x=d.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];}
	}
	
	function MM_openBrWindow(theURL,winName,features) { //v2.0
  		window.open(theURL,winName,"height=672,width=458,toolbar=0,menubar=0,scrollbars=0,resizable=1,status=0,location=0,left=10,top=10");
	}
	function MyId()
	{
		if (http_request.readyState == 4)
		{
			if (http_request.status == 200)
			{
				var txt = http_request.responseText;
				if (txt!='Erreur')
				{
					document.saisie.myid.value=txt;
					http_request="";
				}
			}
		}
	}
	function From()
	{
		cle = document.saisie.cle_pub.value;
		if (window.XMLHttpRequest)
			http_request = new XMLHttpRequest();
		else
			http_request = new ActiveXObject("Microsoft.XMLHTTP");
		var script="httpclepub.php";
		var params="cle="+cle;
		script = script + "?" + params;
		http_request.onreadystatechange = MyId;
		http_request.open('GET',script,true);
		http_request.setRequestHeader("Content-Type","text/html; charset=iso-8859-1");
		http_request.send(params);
	}
//-->
