
			var showpub = function(n,nb,id)  {
				if (n > nb) { var n = '1'; } 
				n--; var bef = n;  n++
				if (bef == '0') bef = nb;
				$( id + bef ).fade('500');
				document.getElementById(id+bef).style.display = 'none';	
				document.getElementById(id+n).style.display = 'block';
				var myFx = new Fx.Tween(id+n);
				myFx.start('opacity', '0', '1');
				setTimeout(function() {	
					n++; 
					showpub(n,nb,id);
				}, 7000);
				
			}

			var showpass = function(n)  {
				if (n == '1') {
					var myFx = new Fx.Tween('mdpdiv');
					myFx.start('opacity', '0', '1');
				}
				else {
					var myFx = new Fx.Tween('mdpdiv');
					myFx.start('opacity', '1', '0');
				}
			}


			var viewpass = function(n)  {
				if (n == '1')	{
					$('login').fade('0');
					$('lostpass').fade('0');
					$('alogin').fade('0');
					$('alostpass').fade('0');
					setTimeout(function() {	
						document.getElementById('login').style.display = 'block';	
						document.getElementById('lostpass').style.display = 'none';
						document.getElementById('alogin').style.display = 'block';	
						document.getElementById('alostpass').style.display = 'none';
						$('login').fade('100');
						$('alogin').fade('100');
					}, 1000);
				} else {
					$('login').fade('0');
					$('lostpass').fade('0');
					$('alogin').fade('0');
					$('alostpass').fade('0');
					setTimeout(function() {	
						document.getElementById('login').style.display = 'none';	
						document.getElementById('lostpass').style.display = 'block';
						document.getElementById('alogin').style.display = 'none';	
						document.getElementById('alostpass').style.display = 'block';
						$('lostpass').fade('100');
						$('alostpass').fade('100');
					}, 1000);
				}
			}
				
			var myAjax = ajax();
			function ajax() {
					var ajax = null;
					if (window.XMLHttpRequest) { try { ajax = new XMLHttpRequest(); } catch(e) {} }
					else if (window.ActiveXObject) {
						try { ajax = new ActiveXObject("Msxm12.XMLHTTP"); }
						catch (e){ try{ ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} }
					}
					return ajax;
			}

			function affresult() { 
					if (myAjax.readyState == 4) {
						printLoadingMessage(myAjax.responseText);
					}
			}
			//********************************
			// RECHERCHE
			function research(str) {
				if (str.length > '1') {
					myAjax.open("POST", "/fichiers/php/base/verif_search.php");
					myAjax.onreadystatechange = function(){
						if (myAjax.readyState == 4 ) {
							var liste = myAjax.responseText;
							$('tag_search').fade('100');
							var cible = document.getElementById('tag_search').innerHTML = liste;
							  var allscript = document.getElementById('tag_search').getElementsByTagName('script');
								for(var i=0;i< allscript.length;i++){
								  eval(allscript[i].text);
								}
						}
					};
					myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
					myAjax.send("search="+str);
				} else { $('tag_search').fade('0'); }
			}

			
			//********************************
			// MAJ IMAGES

			function clickimg(url) {
				document.getElementById('overlay').style.display = "block";
				document.getElementById('loadajax').style.display = "block";
				document.getElementById('loadajax').innerHTML = '<iframe src="'+url+'" width="900" height="480"></iframe><p class="close"><a href="#" onclick="closeajax()">[ Fermer ce cadre ]</a></p>'; 
			}
			function closeajax() {
				document.getElementById('loadajax').innerHTML = ''; 
				document.getElementById('overlay').style.display = "none";
				document.getElementById('loadajax').style.display = "none";
			}
			function closajax(id) {
				document.getElementById(id).innerHTML = ''; 
				document.getElementById(id).style.display = "none";
			}
			function loadajx(url,id) {
				document.getElementById(id).style.display = "block";
				document.getElementById(id).innerHTML = '<p class="center">&nbsp;<br /><br /><b>Chargement en cours... </b><br /><br /><img src="./fichiers/img/loading.gif" alt="chargement" /><br /><br />&nbsp;</p>';
				document.getElementById('overlay').style.display = "block";
				myAjax.open("GET", url);
				myAjax.onreadystatechange = function(){
					if (myAjax.readyState == 4 ) {
						document.getElementById(id).innerHTML = myAjax.responseText;
					}
				}
				myAjax.send(null); 
			}
			function loadjx(url,id) {
				document.getElementById(id).style.display = "block";
				document.getElementById(id).innerHTML = '<p class="center">&nbsp;<br /><br /><b>Chargement en cours... </b><br /><br /><img src="./fichiers/img/loading.gif" alt="chargement" /><br /><br />&nbsp;</p>';
				myAjax.open("GET", url);
				myAjax.onreadystatechange = function(){
					if (myAjax.readyState == 4 ) {
						document.getElementById(id).innerHTML = myAjax.responseText;
					}
				}
				myAjax.send(null); 
			}



			function chiffres(event) {
				// Compatibilité IE / Firefox
				if(!event&&window.event) { event=window.event; }
				// IE
				if((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode != 8) && (event.keyCode != 9) && (event.keyCode != 11)) {
					event.returnValue = false;
					event.cancelBubble = true;
				}
				// DOM
				if((event.which < 48 || event.which > 57) && (event.which != 8) && (event.which != 9) && (event.keyCode != 11)) {
					event.preventDefault();
					event.stopPropagation();
				}
			}
 
			
			
			//********************************
			// MAJ VILLES

			function request(str,id) {
				if (str.length > '2') {
					myAjax.open("POST", "./fichiers/php/base/verif_ville.php");
					myAjax.onreadystatechange = function(){
						if (myAjax.readyState == 4 ) {
							var liste = myAjax.responseText;
							$('tag_update').fade('100');
							var cible = document.getElementById('tag_update').innerHTML = liste;
							document.getElementById('tag_update').style.display = "block";
						}
					};
					myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
					myAjax.send("search="+str+"&idd="+id);
				}
			}

			function selected(cp,ville,id){
					$('tag_update').fade('0');
					document.getElementById('ville'+id).value = ville;
					document.getElementById('cp'+id).value = cp;
					document.getElementById('tag_update').style.display = "none";
			}


			function changeville(id) {
				printLoadingMessage('<span><img src="./fichiers/img/loading.gif> Chargement en cours...<span>');
				document.getElementById('tag_update').style.display = "none";
				myAjax.open("POST", "ajax.php");
				myAjax.onreadystatechange = function(){
					if (myAjax.readyState == 4) {
						if (id == 'new') document.location.href="./?ok=cab";
						printLoadingMessage(myAjax.responseText);
					}
				};
				myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				myAjax.send("case=ville&id="+id+"&adresse="+document.getElementById('adresse'+id).value+"&ville="+document.getElementById('ville'+id).value+"&cp="+document.getElementById('cp'+id).value);
			}

			//********************************
			// AFFICHAGE MESSAGE

			function printLoadingMessage(loadingMessageText) {
				document.getElementById("loadingMessage").innerHTML = loadingMessageText;
				$('loadingMessage').fade('100');
				setTimeout(hideLoadingMessage, 10000);
			}
			function hideLoadingMessage() { $('loadingMessage').fade('0'); }



			//********************************
			// VERIF ISNCRIPTION

			function verifsiren(txt) {
				if(txt.length == '9') {
					document.inscript.siren.className = ''; 
					myAjax.open("POST", "./fichiers/php/base/verif_siren.php");
					myAjax.onreadystatechange = function(){ 
						if (myAjax.readyState == 4 ) {
							var rep = myAjax.responseText;
							if(rep.indexOf('1') >= '0') { 
								document.getElementById("sirenresult").innerHTML = 'Votre code HORIZON + a été trouvé dans notre base.<br /><b>Vous avez un logiciel osteo2ls, ce site vous sera donc gratuit !</b>';
							}
							else { document.getElementById("sirenresult").innerHTML = '&nbsp;'; }
						}
					}
					myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
					myAjax.send("txt="+txt);

				} else if(txt.length >= '1') { 
					document.inscript.siren.className = 'novalid'; 
					document.getElementById("sirenresult").innerHTML = '<b>Votre code HORIZON +  n\'est pas valide.</b><br />Veuillez entrer 9 chiffres seulement, sans espace.';
				} else { 
					document.inscript.siren.className = ''; 
					document.getElementById("sirenresult").innerHTML = '&nbsp;';
				}
			}
			function verifweb(txt) {
				var reg = /^[a-z0-9-_]+$/
				if(reg.test(txt) == false) { 
					document.inscript.adresse.className = 'novalid'; 
					document.getElementById("webresult").innerHTML =  '<b>Veuillez corriger l\'adresse de votre site.</b> <br />Elle ne doit pas contenir d\'espaces, caractères spéciaux ou accents.<br />&nbsp;';	
				}
				else {
					myAjax.open("POST", "./fichiers/php/base/verif_web.php");
					myAjax.onreadystatechange = function(){
						if (myAjax.readyState == 4 ) {
							var rep = myAjax.responseText;
							if(rep.indexOf('1') >= '0') { document.getElementById("webresult").innerHTML = '<b>Cette adresse est déjà utilisée,</b> veuillez en choisir une autre.<br />&nbsp;'; document.inscript.adresse.className='novalid'; }
							else { document.getElementById("webresult").innerHTML = '&nbsp;'; document.inscript.adresse.className=''; }
						}
					}
					myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
					myAjax.send("txt="+txt);
				}
			}
			function verifmail(txt) {
					myAjax.open("POST", "./fichiers/php/base/verif_mail.php");
					myAjax.onreadystatechange = function(){
						if (myAjax.readyState == 4 ) {
							var rep = myAjax.responseText;
							if(rep.indexOf('1') >= '0') { loadajx('./fichiers/php/base/send_mailvalid.php?mail='+txt,'loadajax'); document.inscript.mail.className='novalid'; }
							else { document.inscript.mail.className=''; }
						}
					}
					myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
					myAjax.send("txt="+txt);
			}

			function inscription(txt) { 
				printLoadingMessage('<span><img src="./fichiers/img/loading.gif> Chargement en cours...<span>');
				if(document.inscript.email.value == '') {
					//if(document.inscript.siren.value == '') { document.inscript.siren.className='novalid'; } else { document.inscript.siren.className=''; }
					if(document.inscript.nom.value == '') { document.inscript.nom.className='novalid'; } else { document.inscript.nom.className=''; }
					if(document.inscript.prenom.value == '') { document.inscript.prenom.className='novalid'; } else { document.inscript.prenom.className=''; }
					if(document.inscript.mail.value == '') { document.inscript.mail.className='novalid'; } else { document.inscript.mail.className=''; }
					if(document.inscript.mailb.value == '') { document.inscript.mailb.className='novalid'; } else { document.inscript.mailb.className=''; }
					if(document.inscript.adresse.value == '') { document.inscript.adresse.className='novalid'; } else { document.inscript.adresse.className=''; }
					if(document.inscript.mdp.value == '') { document.inscript.mdp.className='novalid'; } else { document.inscript.mdp.className=''; }
					if(document.inscript.mdpb.value == '') { document.inscript.mdpb.className='novalid'; } else { document.inscript.mdpb.className=''; }
					if(document.inscript.nom.value == '' || document.inscript.prenom.value == '' || document.inscript.mail.value == '' || document.inscript.mailb.value == '' || document.inscript.adresse.value == '' || document.inscript.mdp.value == '' || document.inscript.mdpb.value == '') {
						printLoadingMessage('<span class=r><img src=./fichiers/img/bad.png> Merci de bien vouloir remplir les champs en rouge.</span>');
						return false;
					}					
					else if(document.inscript.mdp.value != document.inscript.mdpb.value) {
						document.inscript.mdp.className = 'novalid'; document.inscript.mdpb.className = 'novalid'; 
						printLoadingMessage('<span class=r><img src=./fichiers/img/bad.png> Vos deux mots de passe ne correspondent pas.</span>');
						return false;
					}	
					else if(document.inscript.mail.value != document.inscript.mailb.value) {
						document.inscript.mail.className = 'novalid'; document.inscript.mailb.className = 'novalid'; 
						printLoadingMessage('<span class=r><img src=./fichiers/img/bad.png> Vos adresses email ne correspondent pas.</span>');
						return false;
					}		
					else if(document.inscript.un.checked && document.inscript.de.checked && document.inscript.tr.checked) {
						myAjax.open("POST", "ajax.php");
						myAjax.onreadystatechange = function(){
							if (myAjax.readyState == 4 ) {
								var rep = myAjax.responseText;
								if(rep.indexOf('1') >= '0') {
									printLoadingMessage('<span class=g><img src=./fichiers/img/clean.png>Votre inscription a bien été enregistrée, merci de cliquer dans le mail que vous aller recevoir.</span>'); 
									document.location.href="./?p=connexion&valid=inscription&m="+document.inscript.mail.value;
								}
								else printLoadingMessage(myAjax.responseText); 
							}
						}
						myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
						myAjax.send("case=inscription&siren="+document.inscript.siren.value+"&sexe="+document.inscript.sexe.value+"&nom="+document.inscript.nom.value+"&prenom="+document.inscript.prenom.value+"&mail="+document.inscript.mail.value+"&adresse="+document.inscript.adresse.value+"&mdp="+document.inscript.mdp.value);
						return false;
					} else { printLoadingMessage('<span class=r><img src=./fichiers/img/bad.png> Vous devez accepter les conditions précisées au bas du formulaire.</span>'); return false; }
				} else {  printLoadingMessage('<span class=r><img src=./fichiers/img/bad.png> SPAMM ?</span>'); return false; }

			}

			//********************************
			// SEND CONTACT

			function sendcontactadmin(id) {
				printLoadingMessage('<span><img src="./fichiers/img/loading.gif> Chargement en cours...<span>');
				if(document.send.txt.value == '') { document.send.txt.className='novalid'; } else { document.send.txt.className=''; }
				if(document.send.txt.value != '') { 
					myAjax.open("POST", "ajax.php?pfilid="+id);
					myAjax.onreadystatechange = affresult;
					myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
					myAjax.send("case=sendadmin&txt="+document.send.txt.value);
					document.send.txt.value = '';
					return false;
				}
				else { printLoadingMessage('<span class=r><img src=./fichiers/img/bad.png> Merci de bien vouloir remplir votre message.</span>'); return false; }
			}

			function sendpass() {
				printLoadingMessage('<span><img src="./fichiers/img/loading.gif> Chargement en cours...<span>');
				if(document.lostpass.txt.value == '') { document.lostpass.txt.className='novalid'; } else { document.lostpass.txt.className=''; }
				if(document.lostpass.txt.value != '') { 
					myAjax.open("POST", "ajax.php");
					myAjax.onreadystatechange = affresult;
					myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
					myAjax.send("case=sendpass&txt="+document.lostpass.txt.value);
					document.lostpass.txt.value = '';
					return false;
				}
				else { printLoadingMessage('<span class=r><img src=./fichiers/img/bad.png> Merci de bien vouloir renseigner votre adresse email.</span>'); return false; }
			}

			function sendcontact(id) {
				printLoadingMessage('<span><img src="./fichiers/img/loading.gif> Chargement en cours...<span>');
				if(document.profil.email.value == '') {
					if(document.profil.nom.value == '') { document.profil.nom.className='novalid'; } else { document.profil.nom.className=''; }
					if(document.profil.prenom.value == '') { document.profil.prenom.className='novalid'; } else { document.profil.prenom.className=''; }
					if(document.profil.mail.value == '') { document.profil.mail.className='novalid'; } else { document.profil.mail.className=''; }
					if(document.profil.mailb.value == '') { document.profil.mailb.className='novalid'; } else { document.profil.mailb.className=''; }
					if(document.profil.txt.value == '') { document.profil.txt.className='novalid'; } else { document.profil.txt.className=''; }
					if(document.profil.nom.value == '' || document.profil.prenom.value == '' || document.profil.mail.value == '' || document.profil.txt.value == '') {
						printLoadingMessage('<span class=r><img src=./fichiers/img/bad.png> Merci de bien vouloir remplir les champs en rouge.</span>');
						return false;
					} else if(document.profil.mail.value != document.profil.mailb.value) { 
						printLoadingMessage('<span class=r><img src=./fichiers/img/bad.png> Vos adresses mail ne correspondent pas.</span>'); 
						document.profil.mail.className = 'novalid'; 
						document.profil.mailb.className= 'novalid'; 
						if(document.profil.mailb.value == '') 'novalid';
						return false; 
					} else {
						myAjax.open("POST", "ajax.php?pfilid="+id);
						myAjax.onreadystatechange = affresult;
						myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
						myAjax.send("case=contact&nom="+document.profil.nom.value+"&prenom="+document.profil.prenom.value+"&tel="+document.profil.tel.value+"&mail="+document.profil.mail.value+"&txt="+document.profil.txt.value);
						//document.profil.nom.value = document.profil.prenom.value = document.profil.tel.value = document.profil.mail.value document.profil.mailb.value = document.profil.txt.value = '';
						return false;
					}
				} else {  printLoadingMessage('<span class=r><img src=./fichiers/img/bad.png> SPAMM ?</span>'); return false; }
			}
			
			
			//********************************
			// AVIS 

			function sendavis(id) {
				printLoadingMessage('<span><img src="./fichiers/img/loading.gif> Chargement en cours...<span>');
				if(document.vote.email.value == '') {
					if(document.vote.nom.value == '') { document.vote.nom.className='novalid'; } else { document.vote.nom.className=''; }
					if(document.vote.txt.value == '') { document.vote.txt.className='novalid'; } else { document.vote.txt.className=''; }
					if(document.vote.nom.value == '' || document.vote.txt.value == '') {
						printLoadingMessage('<span class=r><img src=./fichiers/img/bad.png> Merci de bien vouloir remplir les champs en rouge.</span>');
						return false;
					} else if(document.vote.star.value == '0') { 
						printLoadingMessage('<span class=r><img src=./fichiers/img/bad.png> Merci de bien vouloir noter votre ostéo.</span>'); 
						document.vote.nom.className = document.vote.mail.className = document.vote.txt.className = ''; 
						return false; 
					} else {
						myAjax.open("POST", "ajax.php?pfilid="+id);
						myAjax.onreadystatechange = affresult;
						myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
						myAjax.send("case=avis&nom="+document.vote.nom.value+"&mail="+document.vote.mail.value+"&star="+document.vote.star.value+"&txt="+document.vote.txt.value);
						document.vote.nom.value = document.vote.mail.value = document.vote.txt.value = ''; document.vote.star.value = '0';

						starBaseId 		= new Array('star');
						Nbstar			= 4;				
						Check 			= new Array(0, 0);
						LgtstarBaseId	= new Array();
						for (i =0; i < starBaseId.length; i++)  LgtstarBaseId[i] = starBaseId[i].lastIndexOf('');
						NotationSystem();
						return false;
					}
				} else {  printLoadingMessage('<span class=r><img src=./fichiers/img/bad.png> SPAMM ?</span>'); return false; }
			}


			//********************************
			// STARS


			starBaseId 		= new Array('star');
			Nbstar			= 4;				
			Check 			= new Array(0, 0);
			LgtstarBaseId	= new Array();
			for (i =0; i < starBaseId.length; i++)  LgtstarBaseId[i] = starBaseId[i].lastIndexOf('');
			function NotationSystem() {
				for (j = 0; j < starBaseId.length; j++) {
					for (i=1; i < Nbstar+1; i++) {
						var img	= document.getElementById(starBaseId[j]+i);
						img.key = j;
						img.onclick	= function() {
							if (Check[this.key] == 0) {
								SetOpacity(this.id, this.key, 1);
								Check[this.key] = 1;
								var input = document.getElementById(starBaseId[this.key]);
								input.value = Name2Nb(this.id, this.key);
							}
						};
						img.title = 'Donner la note '+i+'/4';
						img.onmouseover	= function() { if (Check[this.key] == 0)  SetOpacity(this.id, this.key, 1); };
						img.onmouseout = function() { if (Check[this.key] == 0) SetOpacity(this.id, this.key, 0.3); };
					}
				}
			}
			function SetOpacity(star, key, opacity) {
				starNb=Name2Nb(star, key);
				for (var i = 1; i <= starNb; i++) document.getElementById(starBaseId[key]+i).style.opacity = opacity;
			}
			function Name2Nb(star, key) {
				starNb=star.slice(LgtstarBaseId[key]);
				return(starNb);
			}

			//********************************
			// CHANGEMENT MDP

			function changemdp() {
				printLoadingMessage('<span><img src="./fichiers/img/loading.gif> Chargement en cours...<span>');
				if(document.changmdp.mdp1.value != '' && document.changmdp.mdp2.value != '') {
					if(document.changmdp.mdp1.value != document.changmdp.mdp2.value) {
						printLoadingMessage('<span class=r><img src=./fichiers/img/bad.png> Vos deux mots de passe ne correspondent pas.</span>');
					} else  {
						myAjax.open("POST", "./fichiers/php/connect/verif_changemdp.php");
						myAjax.onreadystatechange = affresult;
						myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
						myAjax.send("donnee="+document.changmdp.mdp1.value+"&old="+document.changmdp.mdp0.value);
						document.changmdp.mdp1.value = document.changmdp.mdp2.value = document.changmdp.mdp0.value = '';
					}
				} 
			}

			function changeconfig() {
				myAjax.open("POST", "ajax.php?case=changeconfig");
				myAjax.onreadystatechange = affresult;
				myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				myAjax.send("nom="+document.profil.nom.value+"&prenom="+document.profil.prenom.value+"&sexe="+document.profil.sexe.value);
			}



			function changeurlgoogle() {
				myAjax.open("POST", "ajax.php?case=changeurlgoogle");
				myAjax.onreadystatechange = affresult;
				myAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				myAjax.send("txt="+document.google.analyticstxt.value);
			}



			//********************************
			// TOOGLE


			var toggleDiv = function(name, id) {
				for (x=0; x<=99; x++) { 
					if (x != id && document.getElementById(name+x)) { 
						document.getElementById(name + '_' + x).className = 'pannh'; 
						var myFx = new Fx.Tween(name + x);
						myFx.start('opacity', '0');
					}
				}
				document.getElementById(name + '_' + id).className = 'pannh'; 
				document.getElementById(name + '_' + id).className = 'pannh ok'; 
				var myFx = new Fx.Tween(name + id);
				myFx.start('opacity', '0', '1');
			}

