function closeModif(id){

	$('modif_'+id).toggle();

}

function envoiModifOK(id){

	$('modif_'+id).toggle();

}
var id_ouvert = null;
function validModif(id){
	id_ouvert = id;
	
	nom_asso = encodeURIComponent($('id_nom_modif_association_'+id).value);
	adresse = encodeURIComponent($('id_adresse_modif_association_'+id).value);
	commune = encodeURIComponent($('id_commune_modif_association_'+id).value);
	responsable = encodeURIComponent($('id_responsable_modif_association_'+id).value);
	tel = encodeURIComponent($('id_tel_modif_association_'+id).value);
	tel2 = encodeURIComponent($('id_tel2_modif_association_'+id).value);
	email = encodeURIComponent($('id_email_modif_association_'+id).value);
	site = encodeURIComponent($('id_site_modif_association_'+id).value);
	comment = encodeURIComponent($('id_commentaire_modif_association_'+id).value);
	nom_modif = encodeURIComponent($('id_nom_modif_'+id).value);
	tel_modif = encodeURIComponent($('id_tel_modif_'+id).value);
	statut_modif = encodeURIComponent($('id_statut_modif_'+id).value);
	mel_modif = encodeURIComponent($('id_mel_modif_'+id).value);
	old_nom_asso = encodeURIComponent($('old_nom_association_'+id).value);
	old_adresse = encodeURIComponent($('old_num_voie_association_'+id).value+' '+$('old_lib_voie_association_'+id).value);
	old_commune = encodeURIComponent($('old_commune_association_'+id).value);
	old_responsable = encodeURIComponent($('old_responsable_association_'+id).value);
	old_tel = encodeURIComponent($('old_tel_association_'+id).value);
	old_tel2 = encodeURIComponent($('old_tel2_association_'+id).value);
	old_email = encodeURIComponent($('old_email_association_'+id).value);
	old_site = encodeURIComponent($('old_site_association_'+id).value);
	old_comment = encodeURIComponent($('old_commentaire_association_'+id).value);
		
	if(nom_modif ==''){
		alert('Veuillez saisir votre nom !');
		$('id_nom_modif_'+id).style.backgroundColor = "#fe8282";
	}
	
	if(tel_modif ==''){
		alert('Veuillez saisir votre telephone !');
		$('id_tel_modif_'+id).style.backgroundColor = "#fe8282";
	}
	
	if(statut_modif ==''){
		alert('Veuillez saisir votre statut dans l association !');
		$('id_statut_modif_'+id).style.backgroundColor = "#fe8282";
	}

	
	
	if( (nom_modif !='') && (tel_modif !='') && (statut_modif !='') )
	{
		var parametres = 'id='+id+'&nom_asso='+nom_asso+'&adresse='+adresse+'&commune='+commune+'&responsable='+responsable+'&tel='+tel+'&tel2='+tel2+'&email='+email+'&site='+site+'&comment='+comment+'&nom_modif='+nom_modif+'&tel_modif='+tel_modif+'&mel_modif='+mel_modif+'&statut_modif='+statut_modif+'&old_nom_asso='+old_nom_asso+'&old_adresse='+old_adresse+'&old_commune='+old_commune+'&old_responsable='+old_responsable+'&old_tel='+old_tel+'&old_tel2='+old_tel2+'&old_email='+old_email+'&old_site='+old_site+'&old_comment='+old_comment;
		
		new Ajax.Request(
						 '/ajax/annuaire_LEI/envoiAssoc.php',
							 {
								 'method': 'post',
								 'parameters': parametres,
								 'onComplete' : function(){envoiModifOK(id_ouvert);alert('Votre demande sera traitée rapidement. Merci de votre participation.');}
								
							 }
						)
		}

}


function closeAjout(){

	$('ajout').toggle();
	$('association_pagination').show();
	$('association_pagination_bas').show();
	$('annuaire_association_liste').show();

}

function validAjout(){
	
	
	
	nom_asso = encodeURIComponent($('id_nom_association').value);
	adresse = encodeURIComponent($('id_adresse_association').value);
	commune = encodeURIComponent($('id_commune_association').value);
	responsable = encodeURIComponent($('id_responsable_association').value);
	tel = encodeURIComponent($('id_tel_association').value);
	tel2 = encodeURIComponent($('id_tel2_association').value);
	email = encodeURIComponent($('id_email_association').value);
	site = encodeURIComponent($('id_site_association').value);
	comment = encodeURIComponent($('id_commentaire_association').value);
	nom_ajout = encodeURIComponent($('id_nom_ajout').value);
	tel_ajout = encodeURIComponent($('id_tel_ajout').value);
	statut_ajout = encodeURIComponent($('id_statut_ajout').value);
	mel_ajout = encodeURIComponent($('id_mel_ajout').value);
	
	//verif des champs obligatoire
	
			
		if(nom_ajout ==''){
			alert('Veuillez saisir votre nom !');
			$('id_nom_ajout').style.backgroundColor = "#fe8282";
		}
		
		if(tel_ajout ==''){
			alert('Veuillez saisir votre telephone !');
			$('id_tel_ajout').style.backgroundColor = "#fe8282";
		}
		
		if(statut_ajout ==''){
			alert('Veuillez saisir votre statut dans l association !');
			$('id_statut_ajout').style.backgroundColor = "#fe8282";
		}
		
		
		if( (nom_ajout !='') && (tel_ajout !='') && (statut_ajout !='') )
		{
			
	
		var parametres = 'nom_asso='+nom_asso+'&adresse='+adresse+'&commune='+commune+'&responsable='+responsable+'&tel='+tel+'&tel2='+tel2+'&email='+email+'&site='+site+'&comment='+comment+'&nom_ajout='+nom_ajout+'&tel_ajout='+tel_ajout+'&mel_ajout='+mel_ajout+'&statut_ajout='+statut_ajout;
		
				
		new Ajax.Request(
						 '/ajax/annuaire_LEI/envoiAssoc.php',
							 {
								 'method': 'post',
								 'parameters': parametres,
								 'onComplete' : function(){alert('Votre demande sera traitee rapidement. Merci de votre participation.');}
							 }
						)
		}
		
	$('ajout').toggle();
	$('association_pagination').show();
	$('association_pagination_bas').show();
	$('annuaire_association_liste').show();

}

function envoiOK(){
	
	
	$('ajout').toggle();
	$('association_pagination').show();
	$('association_pagination_bas').show();
	$('annuaire_association_liste').show();
	
}

function affichFormModif(id)
{
	var parametres = 'id='+id;

	new Ajax.Updater(
						 'modif_'+id,
						 '/ajax/annuaire_LEI/modifAssoc.php',
							 {
								 'method': 'post',
								 'parameters': parametres,
 								 'onComplete' : $('modif_'+id).style.display = 'block'	
							 }
						)
}

function affichFormModifDambach(id)
{
	var parametres = 'id='+id;

	new Ajax.Updater(
						 'modif_'+id,
						 '/ajax/annuaire_LEI/modifAssocDambach.php',
							 {
								 'method': 'post',
								 'parameters': parametres,
 								 'onComplete' : $('modif_'+id).style.display = 'block'	
							 }
						)
}








