
var http = new getHTTPObject();
var http2 = new getHTTPObject();
var http3 = new getHTTPObject();

function getHTTPObject() {
		  var xmlhttp;
		  /*@cc_on
		  @if (@_jscript_version >= 5)
		    try {
		      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		      } catch (e) {
		      try {
		        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		        } catch (E) {
		        xmlhttp = false;
		        }
		      }
		  @else
		  xmlhttp = false;
		  @end @*/
		  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		    try {
		      xmlhttp = new XMLHttpRequest();
		      } catch (e) {
		      xmlhttp = false;
		      }
		    }
		  return xmlhttp;
		  }


/* FONCTION D'OUVERTURE DES PAGES. ENVOI VIA AJAX*/ 
var mois_pour_calend;
var annee_pour_calend;

function ouvrir(page,date_en_cours){


if(page == "./contenu/pdf/formation.pdf" || page == "./contenu/pdf/licences.pdf" || page == "./contenu/infoflash/info.pdf"){
	return false;
}

	try{
		//document.getElementById('ajax_loading')
		document.getElementById('chargement').style.zIndex = "50000";
		document.getElementById('ajax_loading').style.display = "inline";
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto;z-index:10000; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";	
	}catch(e){}

	/*
	if(document.getElementById('ajax_loading')){
		document.getElementById('chargement').style.zIndex = "50000";
		document.getElementById('ajax_loading').style.display = "inline";
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto;z-index:10000; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";
	}
	*/
	
	var truc = page.split("_");	//DECOUPAGE DATE
	
	var envoi = "";
	var page_admin = './'+page;
	page = './contenu/pages/'+page+'.php';	

	if(truc[0] == "c"){	//SI C'EST UNE PAGE "DITE" CALENDRIER
		page = truc[1];
		if(page == "concours") page = page+"_"+truc[2];
		var envoi = "envoi="+page;
		page = './contenu/pages/'+page+'.php';
		//alert(page);
	}else{
		if(truc[0] == "Accueil"){
			var envoi = "envoi="+truc[0];
		}else{
			var envoi = "";
		}
	}
	
	
	if(truc[0] == "calend"){
		
		page = './calend/CSO.php';	//SI C'EST UNE PAGE LISTE_CALENDRIER
		var envoi = 'page='+truc[1];
		if(date_en_cours != "ALL"){
			date_en_cours = date_en_cours.split("/");
			envoi += '&annee='+date_en_cours[0];
			envoi += '&mois='+date_en_cours[1];
			envoi += '&jours='+date_en_cours[2];
		}else{
			envoi += '&annee=ALL';
		}
		
		
	}
	if(truc[0] == "admin"){
		var envoi ='calend=admin';
		page = page_admin;
		if(truc[1] == "modif"){ //MODIF D'UNE FICHE "CLUB"
			if(window.confirm("Etes vous sur de vos modifications ?") != true) return false;
			envoi= 'departement='+escape(document.getElementById('dep').value);
			envoi+= '&numero='+escape(document.getElementById('numero').value);
			//alert(document.getElementById('numero').value);
			envoi+= '&EFE='+escape(document.getElementById('FFE').value);
			envoi+= '&nom='+escape(document.getElementById('centre').value);
			envoi+= '&CCF='+escape(document.getElementById('CCF').value);
			envoi+= '&PCF='+escape(document.getElementById('PCF').value);
			envoi+= '&Responsable='+escape(document.getElementById('responsable').value);
			envoi+= '&Adresse='+escape(document.getElementById('adresse').value);
			envoi+= '&CP='+escape(document.getElementById('cP').value);
			envoi+= '&ville='+escape(document.getElementById('ville').value);
			envoi+= '&Tel1='+escape(document.getElementById('tel1').value);
			envoi+= '&Tel2='+escape(document.getElementById('tel2').value);
			envoi+= '&fax='+escape(document.getElementById('fax').value);
			envoi+= '&portable='+escape(document.getElementById('gsm').value);
			envoi+= '&mail='+escape(document.getElementById('mail').value);
			envoi+= '&site='+escape(document.getElementById('site').value);
			envoi+= '&B3='+escape(document.getElementById('B3').value);
			envoi+= '&B2='+escape(document.getElementById('B2').value);
			envoi+= '&B1='+escape(document.getElementById('B1').value);
			envoi+= '&BPJEPS='+escape(document.getElementById('BPJEPS').value);
			envoi+= '&AQA='+escape(document.getElementById('AQA').value);
			envoi+= '&GTE='+escape(document.getElementById('GTE').value);
			envoi+= '&ATE='+escape(document.getElementById('ATE').value);
			envoi+= '&AGREMENT='+escape(document.getElementById('AGREMENT').value);
			envoi+= '&SITUATIONGEO='+escape(document.getElementById('situe').value);
			envoi+= '&ACT1='+escape(document.getElementById('ACT1').value);
			envoi+= '&ACT2='+escape(document.getElementById('ACT2').value);
			envoi+= '&ACT3='+escape(document.getElementById('ACT3').value);
			envoi+= '&ACT4='+escape(document.getElementById('ACT4').value);
			envoi+= '&ACT5='+escape(document.getElementById('ACT5').value);
			envoi+= '&ACT6='+escape(document.getElementById('ACT6').value);
			envoi+= '&ACT7='+escape(document.getElementById('ACT7').value);
			envoi+= '&ACT8='+escape(document.getElementById('ACT8').value);
			envoi+= '&ACT9='+escape(document.getElementById('ACT9').value);
			envoi+= '&ACT10='+escape(document.getElementById('ACT10').value);
			envoi+= '&ACT11='+escape(document.getElementById('ACT11').value);
			envoi+= '&ACT12='+escape(document.getElementById('ACT12').value);
			envoi+= '&ACT13='+escape(document.getElementById('ACT13').value);
			envoi+= '&ENS_CSO='+escape(document.getElementById('ens_cso').checked);
			envoi+= '&ENS_DRES='+escape(document.getElementById('ens_dress').checked);
			envoi+= '&ENS_CCE='+escape(document.getElementById('ens_cce').checked);
			envoi+= '&ENS_TREC='+escape(document.getElementById('ens_trec').checked);
			envoi+= '&ENS_VOLTIGE='+escape(document.getElementById('ens_volt').checked);
			envoi+= '&ENS_ENDURANCE='+escape(document.getElementById('ens_endurance').checked);
			envoi+= '&ENS_HUNTER='+escape(document.getElementById('ens_hunt').checked);
			envoi+= '&ENS_PG='+escape(document.getElementById('ens_pg').checked);
			envoi+= '&ENS_POLO='+escape(document.getElementById('ens_polo').checked);
			envoi+= '&ENS_CROSS='+escape(document.getElementById('ens_cross').checked);
			envoi+= '&ENS_ATT='+escape(document.getElementById('ens_attelage').checked);
			envoi+= '&ENS_HB='+escape(document.getElementById('ens_hb').checked);
			envoi+= '&ENS_BABYP='+escape(document.getElementById('ens_baby').checked);
			envoi+= '&ENS_AMAZONE='+escape(document.getElementById('ens_amazone').checked);
			envoi+= '&ENS_EQUIFUN='+escape(document.getElementById('ens_equifun').checked);
			envoi+= '&ENS_BAJUTSU='+escape(document.getElementById('ens_bajutsu').checked);
			envoi+= '&ENS_WESTERN='+escape(document.getElementById('ens_western').checked);
			envoi+= '&ENS_ETHO='+escape(document.getElementById('ens_etho').checked);
			envoi+= '&ENS_EQUITH='+escape(document.getElementById('ens_equit').checked);
			envoi+= '&ENS_ISLANDE='+escape(document.getElementById('ens_islande').checked);
			envoi+= '&ENS_ROLLER_JOERING='+escape(document.getElementById('ens_roller').checked);
			envoi+= '&ENS_COURSES='+escape(document.getElementById('ens_courses').checked);
			envoi+= '&ENS_JOUTE='+escape(document.getElementById('ens_joute').checked);
			envoi+= '&ENS_BARREL='+escape(document.getElementById('ens_barrel').checked);
			envoi+= '&ENS_EQUITH_SCO='+escape(document.getElementById('ens_equith_sco').checked);
			envoi+= '&ORG_COC_CSO='+escape(document.getElementById('CON_CSO').checked);
			envoi+= '&ORG_COC_DRESS='+escape(document.getElementById('CONC_dress').checked);
			envoi+= '&ORG_COC_CCE='+escape(document.getElementById('conc_cce').checked);
			envoi+= '&ORG_COC_TREC='+escape(document.getElementById('conc_trec').checked);
			envoi+= '&ORG_COC_VOLTIGE='+escape(document.getElementById('conc_volt').checked);
			envoi+= '&ORG_COC_HB='+escape(document.getElementById('conc_hb').checked);
			envoi+= '&ORG_COC_HUNTER='+escape(document.getElementById('conc_hunt').checked);
			envoi+= '&ORG_COC_ATT='+escape(document.getElementById('conc_ATT').checked);
			envoi+= '&ORG_COC_PGAMES='+escape(document.getElementById('conc_PG').checked);
			envoi+= '&ORG_COC_ENDURANCE='+escape(document.getElementById('conc_endu').checked);
			envoi+= '&ORG_COC_RALLY_EQ='+escape(document.getElementById('conc_rally_eq').checked);
			envoi+= '&ORG_COC_BAJUTSU='+escape(document.getElementById('conc_bajutsu').checked);
			envoi+= '&ORG_COC_ETHO='+escape(document.getElementById('conc_etho').checked);
			envoi+= '&ORG_COC_CCRS_CLUB_PONAM='+escape(document.getElementById('conc_ccrs_club').checked);
			envoi+= '&ORG_COC_CCRS_CROSS='+escape(document.getElementById('conc_ccrs_cross').checked);
			envoi+= '&ORG_COC_EQUIFUN='+escape(document.getElementById('coc_equifun').checked);
			envoi+= '&ORG_COC_POLO='+escape(document.getElementById('coc_polo').checked);
			envoi+= '&ORG_COC_BARREL='+escape(document.getElementById('coc_barrel').checked);
			envoi+= '&ORG_COC_JOUTE='+escape(document.getElementById('coc_joute').checked);
			envoi+= '&ORG_COC_HANDIS='+escape(document.getElementById('coc_handis').checked);
			http3.open("POST", page , true);
	
			http3.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			http3.send(envoi);
			http3.onreadystatechange = handle_nimportequoi;	
			return false;
		}
	}
	
	if(truc[1] == "form"){ //Si c'est un formulaire de traitement
		if(date_en_cours == "sup"){
			var envoi = 'supprim_mode='+escape(document.getElementById('id_max').value);
		}else{
			try{var translate = document.getElementById('descript_ajout').value.replace(/’/g,"'");}catch(e){}
				//translate = translate.replace("","'");
			//alert(translate);
			var envoi = 'titre='+escape(document.getElementById('titre').value);
			envoi += '&jour='+escape(document.getElementById('date_ajout').value);
			envoi += '&mois='+escape(document.getElementById('mois_ajout').value);
			envoi += '&annee='+escape(document.getElementById('annee_ajout').value);
			envoi += '&descript='+escape(translate);
			envoi += '&id_max='+escape(document.getElementById('id_max').value);
			if(page == "./admin_form_validation_calend.php"){
				envoi += '&jour2='+escape(document.getElementById('date_ajout2').value);
				envoi += '&mois2='+escape(document.getElementById('mois_ajout2').value);
				envoi += '&annee2='+escape(document.getElementById('annee_ajout2').value);
				envoi += '&contact='+escape(document.getElementById('contact').value);
				try{
					envoi+='&new_descript='+escape(document.getElementById('descript_activ_modif').value);
				}catch(e){
					envoi += '&new_descript='+escape(document.getElementById('descript_activ').value);
				}	
					//envoi += '&disc='+escape(document.getElementById("disc").value);
			}
			
			if(truc[3] == "calend.php"){
				try{
					envoi += '&choix='+escape(document.getElementById('disc_modif').value); 
				}catch(e){
					envoi += '&choix='+escape(document.getElementById('disc').value);
				}
			}
		}
	}
	if(truc[0] == "CLUB"){ //Si c'est une page de déscription d'un club
		page = "./contenu/pages/"+truc[0]+".php"
		var envoi = "numero="+truc[1];
	}
	
	if(page == "./contenu/pages/recherche_valide.php"){	//Page de recherche
		//alert(document.getElementById(document.getElementById('choix_activite').value+"_").name);
		var envoi = 'type_club='+document.getElementById('dep').value;
		if(document.getElementById('choix_activite')) envoi += '&acti='+document.getElementById('choix_activite').value;
		if(document.getElementById('choix_departement')) envoi += '&dep='+document.getElementById('choix_departement').value;
		page = './contenu/pages/Liste_clubs_new.php';
		if(document.getElementById('choix_activite')){
			if(document.getElementById('choix_activite').value != "tous"){
				envoi += "&plop="+document.getElementById(document.getElementById('choix_activite').value+"_").name;
			}
		}
		envoi = envoi.replace('&eacute;','é');
		//alert(envoi);
	}
	
	if(page == "./contenu/pages/modification.php"){	//Modification fiche club
		page = './contenu/pages/modif_coord.php';
		var decoup_page = date_en_cours.split("__");
		var envoi = 'id='+decoup_page[0];
		envoi += '&dep='+decoup_page[1];
	}
	
	http2.open("POST", page , true);
	http2.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	http2.send(envoi);	
	http2.onreadystatechange = handle_infos;
	
}


function handle_nimportequoi(){
	
	if (http3.readyState == 1 || http3.readyState == 2 || http3.readyState == 3){
		document.getElementById('ajax_loading').style.display = "inline";
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto;z-index:50000;background-color:white; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";	
	}
	
	if (http3.readyState == 4){
		document.getElementById('chargement').style.zIndex = "50000";
		document.getElementById('ajax_loading').style.display = "none";
		var infos3 = http3.responseText;	
		document.getElementById('contenu').innerHTML = infos3;
		var truc3 = infos3.split("___");
		if(truc3[1] == "admin"){
			affich_calend('oui',truc3[1]);
		}
		
		if(truc3[1] == "" || truc3[1] == undefined){
			affich_calend('non',''+truc3[1]+'');
		}else{
			affich_calend('oui',truc3[1]);
		}
		var hauteur3 = infos3.split("<>");
		if(hauteur3[1] == "d"){
			var hauteur2 = hauteur3[3];
			hauteur3 = document.getElementById("truc").offsetHeight;
			if(hauteur3 <= "500"){
				document.getElementById('webedix').style.height = parseInt(hauteur2)+"px";
				hauteur3 = (parseInt(hauteur2)+100)+"px";
			}
		}else{
			hauteur3 = hauteur3[1];
		}
		hauteur3 = parseInt(hauteur3);
		hauteur3 = hauteur3+15;
	
		if (hauteur3 >= "500"){
			document.getElementById('webedix').style.height = ""+(hauteur3)+"px";
		}else{
			document.getElementById('webedix').style.height = "750px";
		}
	document.getElementById('chargement').style.zIndex = "0";
	self.location.reload();
	}
	
}

function handle_infos(){
	
	if (http2.readyState == 1 || http2.readyState == 2 || http2.readyState == 3){
		document.getElementById('ajax_loading').style.display = "inline";
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto;z-index:50000;background-color:white; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";	
	}
	
	if (http2.readyState == 4){
			
		try{
			document.getElementById('chargement').style.zIndex = "50000";
			document.getElementById('ajax_loading').style.display = "None";
		
		var infos = http2.responseText;
		
		document.getElementById('contenu').innerHTML = infos;
		var truc = infos.split("___");
		
		
		if(truc[1] == "Accueil"){
			document.getElementById('pubs').style.display = "inline";
		}else{
			if(truc[1] != "admin"){
				document.getElementById('pubs').style.display = "none";
			}
		}
		
		if(truc[1] == "admin"){
			affich_calend('oui',truc[1]);
		}
		
		if(truc[1] == "" || truc[1] == undefined){
			affich_calend('non',''+truc[1]+'');
		}else{
			affich_calend('oui',truc[1]);
		}
		var hauteur = infos.split("<>");
	
		if(hauteur[1] == "d"){
			var hauteur2 = hauteur[3];
			hauteur = document.getElementById("truc").offsetHeight;
			
			if(hauteur <= "500"){
				document.getElementById('webedix').style.height = parseInt(hauteur2)+"px";
				hauteur = (parseInt(hauteur2)+100)+"px";
			}
		}else{
			hauteur = hauteur[1];
		}
		hauteur = parseInt(hauteur);
		hauteur = hauteur+15;
		
		if (hauteur >= "500"){
			document.getElementById('webedix').style.height = ""+(hauteur)+"px";
		}else{
			document.getElementById('webedix').style.height = "750px";
		}
	document.getElementById('chargement').style.zIndex = "0";
	}catch(e){
		var infos = http2.responseText;
		var hauteur = infos.split("<>");
		
		if(hauteur[1] == "d"){
			var hauteur2 = hauteur[3];
			hauteur = document.getElementById("truc").offsetHeight;
			if(hauteur <= "500"){
				document.getElementById('webedix').style.height = parseInt(hauteur2)+"px";
				hauteur = (parseInt(hauteur2)+100)+"px";
			}
		}else{
			hauteur = hauteur[1];
		}
		hauteur = parseInt(hauteur);
		hauteur = hauteur+15;
		
		if (hauteur >= "500"){
			document.getElementById('webedix').style.height = ""+(hauteur)+"px";
		}else{
			document.getElementById('webedix').style.height = "750px";
		}
		
		
	}
	//document.getElementById('chargement').style.zIndex = "50000";
		document.getElementById('ajax_loading').style.display = "None";
	}
	
}

function affich_calend(quoi,nom_page){
	document.getElementById('chargement').style.zIndex = "50000";
	if(nom_page != "admin"){
		init();
		CL.show();
	}
	
	var calend = document.getElementById('calendrier').style;
	
	if(nom_page == "admin"){
		calend.display = "block";
		calend.height = "20px";
		calend.marginTop = "5px";
		calend.width = "220px";
		calend.textAlign = "center";
	}else{
		if(quoi == "oui"){
			if(nom_page == "Accueil"){
				calend.height = "1px";
				calend.display = "none";
				document.getElementById("articles").style.display = "block";
				//document.getElementById("articles").style.height = "";
			}else{
				calend.display = "block";
				calend.height = "230px";
				calend.marginTop = "-15px";
				calend.width = "200px";
				calend.zIndex = "6000";
				document.getElementById('page_en_cours').value = nom_page;
				
				var link = document.getElementById('lien_page_webedix');
					link.innerHTML = '';
					link.style.cursor = 'pointer';
					link.style.fontSize = '11px';
					link.style.color = 'white';
					link.innerHTML= "<b>Calendrier "+nom_page+"</b><br>";
					link.innerHTML+= "<span>Retour vers page "+nom_page+"</span>";
			}
		}else{
			calend.height = "1px";
			calend.display = "none";
		}
	}
	document.getElementById('chargement').style.zIndex = "0";
}

function validation_newsletter(){
	if(document.getElementById('ajax_loading')){
		document.getElementById('chargement').style.zIndex = "50000";
		document.getElementById('ajax_loading').style.display = "inline";
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto;z-index:10000; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";
	}
	var mail = document.getElementById('mail').value;
	
	http.open("POST", 'validation_newsletter.php', true);
	http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	http.send("mail="+mail);	
	http.onreadystatechange = handle_newsletter;	
}



function handle_newsletter(){
	if (http.readyState == 1 || http.readyState == 2 || http.readyState == 3){
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";
	}
	if (http.readyState == 4){
		document.getElementById('ajax_loading').style.display = "None";
		var newsletter = http.responseText;
		
		if(newsletter == ""){
			var ok_c_bon = "<div style='color:white;text-align:center;margin-left:10px; height:10px; width:200px;font-family:verdana; font-size:11px;'>Vous êtes maintenant inscrit.</div>"
			document.getElementById('OK').innerHTML = ok_c_bon;
		}else{
			var pas_ok = "<div style='color:white;text-align:center;margin-left:10px; height:10px; width:200px;font-family:verdana; font-size:11px;'>L'inscription à échouée.</div>"
			document.getElementById('OK').innerHTML = pas_ok;
		}
		document.getElementById('chargement').style.zIndex = "0";
	}
}

/* Récupération de l'ID de la news "cliquée"*/
function validation(ider,ad){
	if(document.getElementById('ajax_loading')){
		document.getElementById('chargement').style.zIndex = "50000";
		document.getElementById('ajax_loading').style.display = "inline";
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto;z-index:50000;background-color:white; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";	
	}
var envoir = 'id='+ider;
	envoir += '&ad='+ad;
	http.open("POST", 'module_news_affichage.php', true);
	http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	http.send(envoir);
	http.onreadystatechange = handleHttpnews;

}

/* FONCTION D'AFFICHAGE DES NEWS*/
function handleHttpnews(){

	if (http.readyState == 1 || http.readyState == 2 || http.readyState == 3){
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";
	}
	if (http.readyState == 4) {
		document.getElementById('ajax_loading').style.display = "None";
		/* Découpage de la réponse */
		var decoupage = http.responseText.split('/*/');
		if(decoupage[4] == "oui"){
			modification(''+decoupage[0]+'',''+decoupage[1]+'',''+decoupage[2]+'',''+decoupage[3]+'',''+decoupage[5]+'');
		}else{
			var date_new = decoupage[2].split("-");
			document.getElementById('divnewz').innerHTML =  "<div style='text-align:center;background-color:#6276A0;width:100%;font-family:arial; font-size:15px;font-weight:bold;'>"+date_new[2]+"-"+date_new[1]+"-"+date_new[0]+"</div>";	//TITRE
			document.getElementById('divnewz').innerHTML += "<div style='text-align:center;background-color:#C7BBD6;font-weight:bold;height:18px;'>"+unescape(decoupage[1])+"</div>";		//DATE
			document.getElementById('divnewz').innerHTML += "<div style='height:88%;width:100%;background-color:#F0F0F0;'><span style='margin-top:2px; margin-left:2px;font-family:arial;'>"+unescape(decoupage[3])+"</span></div>";		//CONTENU
			document.getElementById('divnewz').innerHTML += "<div style='position:absolute; top:88%;left:75%;'><input type='button' value='Fermer' onclick='document.getElementById(\"divnewz\").style.display = \"none\";' /></div></div>";	//BOUTON POUR FERMER
			document.getElementById('divnewz').style.display = "inline";
		}
	}
	document.getElementById('chargement').style.zIndex = "0";
 }
 
 function affichage_calend(i_d,ad){
	if(document.getElementById('ajax_loading')){
		document.getElementById('chargement').style.zIndex = "50000";
		document.getElementById('ajax_loading').style.display = "inline";
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto;z-index:50000;background-color:white; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";	
	}
	
	var envoir = 'id='+i_d;
		envoir += '&ad='+ad;
	http.open("POST", 'affichage_liste_calendrier.php', true);
	http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	http.send(envoir);
	http.onreadystatechange = handleHttpcalend;
}

function handleHttpcalend(){

	if (http.readyState == 1 || http.readyState == 2 || http.readyState == 3){
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";
	}
	if (http.readyState == 4){
		document.getElementById('ajax_loading').style.display = "None";
		
		var decoupage = http.responseText.split('/*/');
		
		if(decoupage[5] == "oui"){
			modification(''+decoupage[0]+'',''+decoupage[1]+'',''+decoupage[2]+'',''+decoupage[3]+'',''+decoupage[4]+'',''+decoupage[6]+'',''+decoupage[7]+'',''+decoupage[8]+'',''+decoupage[9]+'',''+decoupage[10]+'');
		}else{
			
			var new_decoup2 = decoupage[3].split(",");
				new_decoup = "<ul>";
			for(var nd=0;nd<=parseInt(new_decoup2.length)-1;nd++){
				new_decoup += "<li>"+new_decoup2[nd]+"<br />";
			}
			new_decoup += "</ul>";
			new_decoup += "<br />Contact => "+decoupage[9];
			
			document.getElementById('divnewz').innerHTML = "<div style='background-color:#F0F0F0;'>";
			document.getElementById('divnewz').innerHTML +=  "<div style='text-align:center;background-color:#6276A0;width:100%;font-family:arial; font-size:15px;font-weight:bold;'>"+decoupage[1]+" -- "+decoupage[4]+"</div>";	
			document.getElementById('divnewz').innerHTML += "<div style='text-align:center;background-color:#C7BBD6;font-weight:bold;height:18px;'>Du "+decoupage[2]+"</div>";
			if(decoupage[8] != "") document.getElementById('divnewz').innerHTML += "<div style='text-align:center;background-color:#7DA66C;font-weight:bold;height:18px;'>Au "+decoupage[8]+"</div>";
			document.getElementById('divnewz').innerHTML += "<div style='background-color:#F0F0F0;height:220px;width:100%;'>Liste des activités<br /><br />"+new_decoup+"</div>";
			document.getElementById('divnewz').innerHTML += "<div style='position:absolute; top:88%;left:75%;'><input id='btn_fermer' type='button' value='Fermer' onclick='document.getElementById(\"divnewz\").style.display = \"none\";' /></div></div>";
			document.getElementById('divnewz').innerHTML += "</div>";
			document.getElementById('divnewz').style.display = "inline";
			document.getElementById('btn_fermer').onclick = function(){document.getElementById("divnewz").style.display = "none";};
			//document.getElementById('btn_fermer').onclick = function(){alert("none");};
		}
	}
	document.getElementById('chargement').style.zIndex = "0";
 }



/*FONCTION DE RETOUR PAGE. FONCTION APPELLÉE SUR ONCLICK  PAGE_CALENDRIER SUR LA DIV lien_page_webedix*/
function a(){
	var nom_page = document.getElementById('page_en_cours').value;
	ouvrir("c_"+nom_page);
}
/* FONCTION POUR PALIé LE BUG FF des ouvertures AJAX succèssives*/
function b(e,f,g){

	if(document.getElementById('ajax_loading')){
		document.getElementById('chargement').style.zIndex = "50000";
		document.getElementById('ajax_loading').style.display = "inline";
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto;z-index:50000;background-color:white; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";	
	}
var envoi = "";
	http.open("POST", './contenu/pages/CLUB.php', true);
	http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	http.send(envoi);	
	http.onreadystatechange = handle_truc;	
}
function handle_truc(){
	if (http.readyState == 1 || http.readyState == 2 || http.readyState == 3){
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";
	}
	if (http.readyState == 4){
		document.getElementById('ajax_loading').style.display = "None";
	}
	document.getElementById('chargement').style.zIndex = "0";
}

/* FONCTION DE MODIFICATION DES NEWS ! IDE EST RENVOYÉ A LA FONCTION OUVRIR*/
function modification(ide,nom,date,texte,disc,page,selecta,date_fin,contact){
	
	if(document.getElementById('ajax_loading')){
		document.getElementById('ajax_loading').style.display = "inline";
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto;z-index:50000;background-color:white; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";	
	}
	
if(page=="calend"){
	var tablo = date.split("-");
	var tablo2 = date_fin.split("-");
	var selecteda = selecta.split("/**");
		
		document.getElementById('divnewz').innerHTML =  "<div style='text-align:center;background-color:#6276A0;font-family:arial;font-weight:bold;height:22px;border:5px solid #6276A0;'>Titre : <input type='text' id='titre' value='"+unescape(nom)+"' /></div>";	//TITRE
		document.getElementById('divnewz').innerHTML += "<div style='text-align:center;background-color:#C7BBD6;font-weight:bold;height:22px;border:5px solid #C7BBD6;'>jour : <input style='width:30px;' type='text' id='date_ajout' value='"+tablo[0]+"' /> mois : <input style='width:30px;' type='text' id='mois_ajout' value='"+tablo[1]+"' /> ann&eacute;e : <input style='width:30px;' type='text' id='annee_ajout' value='"+tablo[2]+"' /></div>";		//DATE
		document.getElementById('divnewz').innerHTML += "<div style='text-align:center;background-color:#A7BCD6;font-weight:bold;height:22px;border:5px solid #C7BBD6;'>jour : <input style='width:30px;' type='text' id='date_ajout2' value='"+tablo2[0]+"' /> mois : <input style='width:30px;' type='text' id='mois_ajout2' value='"+tablo2[1]+"' /> ann&eacute;e : <input style='width:30px;' type='text' id='annee_ajout2' value='"+tablo2[2]+"' /></div>";		//DATE
		document.getElementById('divnewz').innerHTML += "<div align='center'><div id='se'>"; // Ici on inclu le SELECT
		document.getElementById('divnewz').innerHTML += "</div></div>"; // FIN des divs créations select
		document.getElementById('divnewz').innerHTML += "<div style='height:5%;width:100%;background-color:#F0F0F0;font-weight:bold;text-align:center;'><div style='background-color:#F0F0F0;height:20px;'>D&eacute;scription :</div>";
		document.getElementById('divnewz').innerHTML += "<br /><div align='center'>Activit&eacute;s (s&eacute;par&eacute;es par des virgules) :<br /><i>Exemple : CSO,Pro2,Dressage</i><br /><input type='text' size='40' name='descript_activ_modif' id='descript_activ_modif' value='"+texte+"' /><br />Contact : <br /><input type='text' size='30' name='contact' id='contact' value='"+contact+"' /><br /><br /></div>";
		document.getElementById('divnewz').innerHTML += "</div>";		//CONTENU
		document.getElementById('divnewz').innerHTML += "<input type='hidden' id='id_max' value='modif_"+ide+"' />";
		document.getElementById('divnewz').innerHTML += "<div style='background-color:black;position:absolute; top:88%;left:75%;'><input type='button' value='OK' onclick='document.getElementById(\"divnewz\").style.display = \"none\";ouvrir(\"admin_form_validation_calend.php\","+ide+");' /></div>";	//BOUTON POUR FERMER
		document.getElementById('divnewz').innerHTML += "<div style='position:absolute;background-color:yellow; top:88%;left:15%;'><input type='button' value='Supprimer' onclick='if(!confirm(\"Êtes vous sur ?\")) {return false};document.getElementById(\"divnewz\").style.display = \"none\";ouvrir(\"admin_form_validation_calend.php\",\"sup\");' /></div>";	//BOUTON POUR FERMER
		document.getElementById('divnewz').style.display = "inline";
		/* Création du select  !*/ 
		
		var new_liste = document.createElement("select");
		document.getElementById('se').parentNode.appendChild(new_liste);
		new_liste.setAttribute("id", "disc_modif");
		new_liste.setAttribute("name", "disc_modif");
		var new_option = document.createElement("option");
		/* Création des options ! */
		
		new_option.innerHTML = disc;
		new_option.value = disc;
		new_option.selected = true;
		new_liste.appendChild(new_option);
		for (var i=0; i<9; i++){
			if(selecteda[i] == disc){	continue;	}
				new_option = document.createElement("option");
				new_option.innerHTML = selecteda[i];
				new_option.value = selecteda[i];
				new_liste.appendChild(new_option);
		}
}else{	
	var tablo = date.split("-");
		document.getElementById('divnewz').innerHTML =  "<div style='text-align:center;background-color:#6276A0;font-family:arial;font-weight:bold;height:22px;border:5px solid #6276A0;'>Titre : <input type='text' id='titre' value='"+unescape(nom)+"' /></div>";	//TITRE
		document.getElementById('divnewz').innerHTML += "<div style='text-align:center;background-color:#C7BBD6;font-weight:bold;height:22px;border:5px solid #C7BBD6;'>jour : <input style='width:30px;' type='text' id='date_ajout' value='"+tablo[2]+"' /> mois : <input style='width:30px;' type='text' id='mois_ajout' value='"+tablo[1]+"' /> ann&eacute;e : <input style='width:30px;' type='text' id='annee_ajout' value='"+tablo[0]+"' /></div>";		//DATE
		document.getElementById('divnewz').innerHTML += "<div style='height:5%;width:100%;background-color:#F0F0F0;font-weight:bold;text-align:center;'>D&eacute;scription : <textarea style='width:299px;height:150px;' name='descript_ajout' id='descript_ajout'>"+unescape(texte)+"</textarea></div>";		//CONTENU
		document.getElementById('divnewz').innerHTML += "<input type='hidden' id='id_max' value='modif_"+ide+"' />";
		document.getElementById('divnewz').innerHTML += "<div style='position:absolute; top:88%;left:75%;'><input type='button' value='OK' onclick='document.getElementById(\"divnewz\").style.display = \"none\";ouvrir(\"admin_form_validation_news.php\","+ide+");' /></div>";	//BOUTON POUR FERMER
		document.getElementById('divnewz').innerHTML += "<div style='position:absolute; top:88%;left:15%;'><input type='button' value='Supprimer' onclick='if(!confirm(\"Êtes vous sur ?\")) {return false};document.getElementById(\"divnewz\").style.display = \"none\";ouvrir(\"admin_form_validation_news.php\",\"sup\");' /></div>";	//BOUTON POUR FERMER
		document.getElementById('divnewz').style.display = "inline";
	}
document.getElementById('ajax_loading').style.display = "None";
}


var checkflag = "false";

function checkall(test){
	if(checkflag == "false"){
		for(var i=0;i<test;i++){
			document.getElementById('case'+i).checked = true;
		}
		checkflag = "true";
		document.getElementById('acocher').value = "Tout décocher";
	}else{
		for(var i=0;i<test;i++){
			document.getElementById('case'+i).checked = false;
		}
		document.getElementById('acocher').value = "Tout cocher";
		checkflag = "false";
	}
}

function recherche(type_club,abc){
	//alert(type_club+" "+abc);
	if(document.getElementById('ajax_loading')){
		document.getElementById('chargement').style.zIndex = "50000";
		document.getElementById('ajax_loading').style.display = "inline";
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto;z-index:50000;background-color:white; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";	
	}
		
	var envoi = 'type_de_club='+type_club;
	http.open("POST", './traitement_recherche_new.php', true);
	http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	http.send(envoi);	
	http.onreadystatechange = handle_recherche;

}



function handle_recherche(){
	
	if (http.readyState == 1 || http.readyState == 2 || http.readyState == 3){
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";
	}
	if (http.readyState == 4){
		document.getElementById('ajax_loading').style.display = "None";
		var recherche3 = http.responseText;
		//alert(recherche3);
		var decoupage = recherche3.split('__');
				
			document.getElementById('acti').innerHTML = "";
			document.getElementById('acti').innerHTML = "Activités : ";
			
			var new_liste = document.createElement("select");
			document.getElementById('acti').appendChild(new_liste);
			new_liste.setAttribute("id", "choix_activite");
			new_liste.setAttribute("name", "choix_activite");
			
			var new_option = document.createElement("option");
			/* Création des options ! */
			new_option.innerHTML = "Toutes";
			new_option.value = "tous";
			new_option.selected = true;
			new_liste.appendChild(new_option);
			
			var decoup_ville = decoupage[1].split('/*/');
			//alert(parseInt((decoup_ville.length-2)/2));
			
			
			for (var i=0; i<=(decoup_ville.length-2)/2; i++){
				var numero = (decoup_ville[parseInt(i*2)]);
				var decoup_ville2 = decoup_ville[parseInt(i*2)+1];
				new_option = document.createElement("option");
				new_option.innerHTML = decoup_ville2;
				new_option.value = decoup_ville2;
				new_option.id = decoup_ville2+"_";
				new_option.name = numero;
				new_liste.appendChild(new_option);
				//alert(new_option.id+new_option.name);
			}
		new_liste.onchange = function(){ choix_departement(this.value) };
	}
	document.getElementById('chargement').style.zIndex = "0";
}

function choix_departement(departement){
	if(document.getElementById('ajax_loading')){
		document.getElementById('chargement').style.zIndex = "50000";
		document.getElementById('ajax_loading').style.display = "inline";
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto;z-index:50000;background-color:white; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";	
	}
	if(departement == "tous"){
		departement = "*";
	}
	
	var numero = document.getElementById(departement+"_").name;
		numero = parseInt(numero);
		numero = numero;
	var envoi = "dep="+escape(departement);
	envoi += "&type_cloub="+document.getElementById('dep').value;
	envoi += "&num="+numero;
	//alert(envoi);
	http.open("POST", './traitement_recherche_new.php', true);
	http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	http.send(envoi);	
	http.onreadystatechange = handle_departement;	
}


function handle_departement(){
	if (http.readyState == 1 || http.readyState == 2 || http.readyState == 3){
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";
	}
	if (http.readyState == 4){
		document.getElementById('ajax_loading').style.display = "None";
		var recherche3 = http.responseText;
		//alert("RECHERCHE = "+recherche3);
		//alert(recherche3.split('/*/').length);
		
			document.getElementById('departement_recherche').innerHTML = "";
			document.getElementById('departement_recherche').innerHTML = "D&eacute;partement : ";
			
			var new_liste = document.createElement("select");
			document.getElementById('departement_recherche').appendChild(new_liste);
			new_liste.setAttribute("id", "choix_departement");
			new_liste.setAttribute("name", "choix_departement");
			
			var new_option = document.createElement("option");
			/* Création des options ! */
			new_option.innerHTML = "Tous";
			new_option.value = "tous";
			new_option.selected = true;
			new_liste.appendChild(new_option);
			
			//alert("LONGUEUR => "+decoupage.length);
			var decoup_ville = recherche3.split('/*/');
			for (var i=0; i<=decoup_ville.length-2; i++){
				new_option = document.createElement("option");
				new_option.innerHTML = decoup_ville[i];
				new_option.value = decoup_ville[i];
				new_option.id = decoup_ville[i]+"_";
				new_option.name = i;
				new_liste.appendChild(new_option);
			}
		document.getElementById('chargement').style.zIndex = "0";
	}
}

function verification_ajout(mode){
	if(document.getElementById('ajax_loading')){
		document.getElementById('ajax_loading').style.display = "inline";
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto;z-index:50000;background-color:white; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";	
	}
	if(mode != "suppression"){
		var nom = document.getElementById('nom').value;
		var url = document.getElementById('url').value;
		var adresse = document.getElementById('mail').value;
			
		if(nom == "" || nom == "Le site de "){
			alert('Vous n\'avez pas entré un nom correct');
			return false;
		}
		if(url == "" || url == "http://"){
			alert('Un lien n\'à pas lieu d\'exister sans adresse');
			return false;
		}
		if(adresse != ""){
			var place = adresse.indexOf("@",1); 
			var point = adresse.indexOf(".",place+1); 
			if ((place > -1)&&(adresse.length >2)&&(point > 1)){ 
			
			}else{ 
				alert('Entrez une adresse e-mail valide SVP !'); 
				return false; 
			}
		}
	}
	var numer_lien = parseInt(document.getElementById('numero_lien').value);
	document.getElementById('numero_lien').value = numer_lien+1;
	document.getElementById('mode').value = mode;
	document.liens.submit();
}

function modification_liens(id_di,new_nom,new_url,new_mail){
	
	window.scrollTo(0,0);	// Équivalent du href=#top;
	document.getElementById('valideur').value = "Modifier";
	document.getElementById('valideur').onclick = function(){ verification_ajout("modification") };
	document.getElementById('nom').value = new_nom;	
	document.getElementById('url').value = new_url;
	document.getElementById('mail').value = new_mail;
	document.getElementById('id_di').value = id_di;
}

function suppression_liens(id_di){
	
	if(window.confirm("Etes vous sur de supprimer ?") != true) return false;
	document.getElementById('id_di').value = id_di;
	verification_ajout("suppression");
}

function radio(ref){
	document.getElementById('reponse').innerHTML = "";
	document.getElementById('dep_gen').style.display = "none";
	document.getElementById('dep_rad_1').style.display = "none";
	document.getElementById('dep_rad_2').style.display = "none";
	document.getElementById('dep_rad_3').style.display = "none";
	document.getElementById('dep_rad_4').style.display = "none";
	document.getElementById('dep_rad_5').style.display = "none";
	
	if(document.getElementById('ajax_loading')){
		document.getElementById('ajax_loading').style.display = "inline";
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto;z-index:50000;background-color:white; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";	
	}
	
	document.getElementById('dep_'+ref).style.display = "inline";
	document.getElementById('dep_gen').style.display = "inline";
	
	document.getElementById('ajax_loading').style.display = "none";

}

function departement_club(){
	
	for(var i=1;i<=5;i++){
	
		if(document.getElementById('rad_'+i+'').checked == true){
			var recup = document.getElementById('dep_rad_'+i+'').value;
			var envoi = "numero="+recup;
				envoi += "&dep="+i;
				
			http.open("POST", './admin_affich_departement_club.php', true);
			http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			http.send(envoi);	
			http.onreadystatechange = handle_departement_club;	
		}
	}
}

function handle_departement_club(){
	if (http.readyState == 1 || http.readyState == 2 || http.readyState == 3){
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";
	}
	
	if (http.readyState == 4){
		document.getElementById('ajax_loading').style.display = "None";
		
		document.getElementById('reponse').innerHTML = "";
		var decoupage_reponse = http.responseText.split("/*/");
		document.getElementById('reponse').innerHTML = "<br><br>Login => "+decoupage_reponse[0]+"<br><br>Mot de passe => "+decoupage_reponse[1];
		document.getElementById('reponse').innerHTML += "<br><br>Les mot de passe et login suivant on été créer dans la base de données. Vous pourrez les communiquer au club ci-dessus";
	}
}

function sous_menu_over(id_di){
	for(var compte=1;compte<=17;compte++){
		try{
		document.getElementById("Sousmenu"+compte).style.display = "none";
		}catch(e){}
	}
	try{
	document.getElementById("Sousmenu"+id_di).style.top = 29 * (id_di) + "px";
	document.getElementById("Sousmenu"+id_di).style.display="inline";
	}catch(e){}
}

function sous_menu_out(id_di){
	//alert("");
	//document.getElementById("Sousmenu2").style.display="none";
}

function verif_csv(){
	var nom_fichier = document.getElementById('fichier_csv').value;
	var test_csv = nom_fichier.indexOf(".csv",0);
	if(test_csv != "-1"){
		document.envoi_csv.submit();
	}else{
		alert("Le fichier spécifié doit être un fichier CSV");
		return false;
	}
}

var http_up = new getHTTPObject();
function up(id_di){
	id_di = parseInt(id_di);
	var envoi = "id="+id_di;
		envoi += "&mode=up";
		
		http_up.open("POST", './admin_liens_classement.php', true);
		http_up.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		http_up.send(envoi);	
		http_up.onreadystatechange = handle_up;
}

function handle_up(){
	if (http_up.readyState == 1 || http_up.readyState == 2 || http_up.readyState == 3){
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";
	}
	
	if (http_up.readyState == 4){
		document.getElementById('ajax_loading').style.display = "None";
		document.location.href='admin.php?page=admin_liens';
	}
}

var http_down = new getHTTPObject();
function down(id_di){
	id_di = parseInt(id_di);
	var envoi = "id="+id_di;
		envoi += "&mode=down";
		
		http_down.open("POST", './admin_liens_classement.php', true);
		http_down.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		http_down.send(envoi);	
		http_down.onreadystatechange = handle_down;
}

function handle_down(){
	if (http_down.readyState == 1 || http_down.readyState == 2 || http_down.readyState == 3){
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";
	}
	
	if (http_down.readyState == 4){
		document.getElementById('ajax_loading').style.display = "None";
		document.location.href='admin.php?page=admin_liens';
	}
}

var http_categorie = new getHTTPObject();
function categorie(id_di){
	var categorie_entry = document.getElementById("categorie_"+id_di).value;
	var envoi = "id="+id_di;
		envoi += "&categorie="+categorie_entry;
	
		http_categorie.open("POST", './admin_liens_categorie.php', true);
		http_categorie.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		http_categorie.send(envoi);	
		http_categorie.onreadystatechange = handle_categorie;
}

function handle_categorie(){
	if (http_categorie.readyState == 1 || http_categorie.readyState == 2 || http_categorie.readyState == 3){
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";
	}
	
	if (http_categorie.readyState == 4){
		document.getElementById('ajax_loading').style.display = "None";
		var decoupage = http_categorie.responseText.split("/*/");
			document.getElementById("categorie_"+decoupage[0]).value = decoupage[1];
		alert("Catégorie bien modifiée");
		//document.location.href='admin.php?page=admin_liens';
	}
}


function formulaire_de_mail(){
	var nom2 = document.getElementById("nom2").value;
	var mail2 = document.getElementById("mail2").value;
	var message2 = document.getElementById("message2").value;
	var arobase2 = mail2.indexOf("@");
	var point2 = mail2.lastIndexOf(".");
	
	if((arobase2 < 3)||(point2 + 2 > mail2.length)||(point2 < arobase2+3)){
		alert("L'adresse e-mail que vous avez renseigné est invalide");
		return false;
	}
	if(nom2 == "" || mail2 == "" || message2 == ""){
		alert("Vous devez remplir tous les champs pour completer ce formulaire");
		return false;
	}
	
	document.formulaire_contact.submit();
}

var http_up = new getHTTPObject();
function up_article(id_di){
	id_di = parseInt(id_di);
	var envoi = "id="+id_di;
		envoi += "&mode=up";
		
		http_up.open("POST", './admin_articles_classement.php', true);
		http_up.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		http_up.send(envoi);	
		http_up.onreadystatechange = handle_up;
}

function handle_up(){
	if (http_up.readyState == 1 || http_up.readyState == 2 || http_up.readyState == 3){
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";
	}
	
	if (http_up.readyState == 4){
		document.getElementById('ajax_loading').style.display = "None";
		document.location.href='admin.php?page=admin_articles';
	}
}

var http_down = new getHTTPObject();
function down_article(id_di){
	id_di = parseInt(id_di);
	var envoi = "id="+id_di;
		envoi += "&mode=down";
		
		http_down.open("POST", './admin_articles_classement.php', true);
		http_down.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		http_down.send(envoi);	
		http_down.onreadystatechange = handle_down;
}

function handle_down(){
	if (http_down.readyState == 1 || http_down.readyState == 2 || http_down.readyState == 3){
		document.getElementById('ajax_loading').innerHTML = "<div style='margin-top:auto; margin-bottom:auto;'><img src='./contenu/ajax-loader.gif'><br>Chargement...<br>Veuillez patienter SVP.</div>";
	}
	
	if (http_down.readyState == 4){
		document.getElementById('ajax_loading').style.display = "None";
		document.location.href='admin.php?page=admin_articles';
	}
}
