function closeModif(id){

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

}

function envoiModifOK(id){

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

}

var id_ouvert = null;
function validModif(id){
	id_ouvert = id;
	nom_entreprise = encodeURIComponent($('id_modif_nom_entreprise_'+id).value);
	adresse = encodeURIComponent($('id_modif_adresse_entreprise_'+id).value);
	commune = encodeURIComponent($('id_modif_commune_entreprise_'+id).value);
	civ_responsable = encodeURIComponent($('id_modif_civilite_responsable_entreprise_'+id).value);
	nom_responsable = encodeURIComponent($('id_modif_nom_responsable_entreprise_'+id).value);
	prenom_responsable = encodeURIComponent($('id_modif_prenom_responsable_entreprise_'+id).value);
	tel = encodeURIComponent($('id_modif_tel_entreprise_'+id).value);
	tel2 = encodeURIComponent($('id_modif_tel2_entreprise_'+id).value);
	email = encodeURIComponent($('id_modif_email_entreprise_'+id).value);
	site = encodeURIComponent($('id_modif_site_entreprise_'+id).value);
	comment = encodeURIComponent($('id_modif_commentaire_entreprise_'+id).value);
	nom_modif = encodeURIComponent($('id_nom_modif_'+id).value);
	tel_modif = encodeURIComponent($('id_tel_modif_'+id).value);
	mel_modif = encodeURIComponent($('id_mel_modif_'+id).value);
	statut_modif = encodeURIComponent($('id_statut_modif_'+id).value);
	old_nom_entreprise = encodeURIComponent($('old_id_nom_entreprise_'+id).value);
	old_adresse = encodeURIComponent($('old_id_num_voie_entreprise_'+id).value+' '+$('old_id_lib_voie_entreprise_'+id).value);
	old_commune = encodeURIComponent($('old_id_commune_entreprise_'+id).value);
	old_civ_responsable = encodeURIComponent($('old_id_civilite_responsable_entreprise_'+id).value);
	old_nom_responsable = encodeURIComponent($('old_id_nom_responsable_entreprise_'+id).value)
	old_prenom_responsable = encodeURIComponent($('old_id_prenom_responsable_entreprise_'+id).value);
	old_tel = encodeURIComponent($('old_id_tel_entreprise_'+id).value);
	old_tel2 = encodeURIComponent($('old_id_tel2_entreprise_'+id).value);
	old_email = encodeURIComponent($('old_id_email_entreprise_'+id).value);
	old_site = encodeURIComponent($('old_id_site_entreprise_'+id).value);
	old_comment = encodeURIComponent($('old_id_commentaire_entreprise_'+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 entreprise !');
		$('id_statut_modif_'+id).style.backgroundColor = "#fe8282";
	}

	
	
	if( (nom_modif !='') && (tel_modif !='') && (statut_modif !='') )
	{
			
	
		var parametres = 'id='+id+'&nom_entreprise='+nom_entreprise+'&adresse='+adresse+'&commune='+commune+'&civ_responsable='+civ_responsable+'&nom_responsable='+nom_responsable+'&prenom_responsable='+prenom_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_entreprise='+old_nom_entreprise+'&old_adresse='+old_adresse+'&old_commune='+old_commune+'&old_civ_responsable='+old_civ_responsable+'&old_nom_responsable='+old_nom_responsable+'&old_prenom_responsable='+old_prenom_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/envoiEntreprise.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_entreprise = encodeURIComponent($('id_nom_entreprise').value);
	siret = encodeURIComponent($('id_siret_entreprise').value);
	adresse = encodeURIComponent($('id_adresse_entreprise').value);
	commune = encodeURIComponent($('id_commune_entreprise').value);
	civ_responsable = encodeURIComponent($('id_civilite_responsable_entreprise').value);
	nom_responsable = encodeURIComponent($('id_nom_responsable_entreprise').value);
	prenom_responsable = encodeURIComponent($('id_prenom_responsable_entreprise').value);
	tel = encodeURIComponent($('id_tel_entreprise').value);
	tel2 = encodeURIComponent($('id_tel2_entreprise').value);
	email = encodeURIComponent($('id_email_entreprise').value);
	site = encodeURIComponent($('id_site_entreprise').value);
	comment = encodeURIComponent($('id_commentaire_entreprise').value);
	nom_ajout = encodeURIComponent($('id_nom_ajout').value);
	tel_ajout = encodeURIComponent($('id_tel_ajout').value);
	mel_ajout = encodeURIComponent($('id_mel_ajout').value);
	statut_ajout = encodeURIComponent($('id_statut_ajout').value);
		
				
		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 entreprise !');
			$('id_statut_ajout').style.backgroundColor = "#fe8282";
		}

		
		
		if( (nom_ajout !='') && (tel_ajout !='') && (statut_ajout !='') )
		{
		
	
		var parametres = 'nom_entreprise='+nom_entreprise+'&siret='+siret+'&adresse='+adresse+'&commune='+commune+'&civ_responsable='+civ_responsable+'&nom_responsable='+nom_responsable+'&prenom_responsable='+prenom_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/envoiEntreprise.php',
							 {
								 'method': 'post',
								 'parameters': parametres,
								 'onComplete' : function(){alert('Votre demande sera traitée rapidement. Merci de votre participation.');}
							
							 }
						)
		}
	$('association_pagination').show();
	$('association_pagination_bas').show();
	$('annuaire_association_liste').show();

}

function envoiOK(){
	
	$('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/modifEntreprise.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/modifEntrepriseDambach.php',
							 {
								 'method': 'post',
								 'parameters': parametres,
 								 'onComplete' : $('modif_'+id).style.display = 'block'	
							 }
						)
}



