
function checkAll(field)
{
	mainField=document.getElementById('main_'+field).checked;
	cpt = document.getElementById('listeContacts').elements[field].length;
	for (i = 0; i < cpt; i++)
	{
		if(mainField==true)
		{	
			document.getElementById('listeContacts').elements[field][i].checked = true ;
		}
		else
		{	
			document.getElementById('listeContacts').elements[field][i].checked = false ;
		}
	}
}


function switchDisplay(element)
{
	if( document.getElementById(element).style.display=="block") {
		document.getElementById(element).style.display="none";
	} else {
		document.getElementById(element).style.display="block";
	}

}

function montre( menu ){
	if( document.getElementById( menu ).style.display=="block" || document.getElementById( menu ).style.display=="" ) {
		document.getElementById( menu ).style.display="none";
	} else {
		document.getElementById( menu ).style.display="block";
	}
}

function emptyAjxContainer()
{
	if( document.getElementById("cropfile") ) {
		jQuery('#cropfile').imgAreaSelect( {remove: true} );
	}

	document.getElementById("ajx_container").innerHTML = "";
	document.getElementById("ajx_container").style.display = "none";
	document.body.style.overflow = "visible";
}

function supf(id) {

	var params = 'idUtilisateur='+id+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_admin_viewutilisateurprofile.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_connexion2.tpl.php', 
		{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
	
	document.getElementById("ajx_container").style.display="block";
}

function afficheConnexion() {

	var params = 'ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_connexion2.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_connexion2.tpl.php', 
		{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
	
	document.getElementById("ajx_container").style.display="block";
}

function sendConnexion() { 

	document.getElementById('load').style.display = "block";
	setTimeout("document.getElementById('load').style.display = 'none';",2000);

	//get the values form the form
	var login = document.getElementById("login").value;
	var password = document.getElementById("password").value;
	//place the values in a parameter as a name value pair: name=value
	var params = 'action=connexion&login='+login+'&password='+password+'&ajax=1';	
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_connexion.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#connect').html(data);
		}
	});
	
	/*new Ajax.Updater('connect','/apps/client/templates/includes/ajx_connexion.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
}

function sendConnexion4() { 

	//get the values form the form
	var login = document.getElementById("login").value;
	var password = document.getElementById("password").value;
	
	//place the values in a parameter as a name value pair: name=value
	var params = 'action=connexion&login='+login+'&password='+password+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_connexion3.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#connect').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'connect',
		'/apps/client/templates/includes/ajx_connexion3.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);*/
}

function sendConnexion2() { 
   //get the values form the form
	var login = document.getElementById("login").value;
	var password = document.getElementById("password").value;
	//place the values in a parameter as a name value pair: name=value
	var params = 'action=connexion&login='+login+'&password='+password+'&ajax=1';	
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_connexion2.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_connexion2.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
	
	document.getElementById("ajx_container").style.display="block";
}

function sendConnexion3() { 
   //get the values form the form
	var login = document.getElementById("login").value;
	var password = document.getElementById("password").value;
	var email = document.getElementById("email").value;
	var idutilisateur = document.getElementById("idutilisateur").value;
	
	//place the values in a parameter as a name value pair: name=value
	var params = 'action=connexion&login='+login+'&password='+password+'&email='+email+'&idutilisateur='+idutilisateur+'&ajax=1';

	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_addemailtoexistingaccount.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});	
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_addemailtoexistingaccount.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
	
	document.getElementById("ajx_container").style.display="block";
}


function afficheDeconnexion() {
	
	document.getElementById("ajx_container").style.display="block";
	document.body.style.overflow = "hidden";
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_deconnexion.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});	
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_deconnexion.tpl.php', 
		{ 
			method:'post', 
			asynchronous:true, 
			evalScripts:true
		}
	);*/
}

function sendDeconnexion() {

	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_deconnexion_ok.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});	
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_deconnexion_ok.tpl.php', 
		{ 
			method:'post',
			asynchronous:true, 
			evalScripts:true
		}
	);*/
}

function deconnexion() { 
    
	//get the values form the form
	var login = document.getElementById("login").value;
	var password = document.getElementById("password").value;
	//place the values in a parameter as a name value pair: name=value
	var params = 'action=connexion&login='+login+'&password='+password+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_deconnexion.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});	
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_deconnexion.tpl.php',
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
	
	document.getElementById("ajx_container").style.display="block";
}

function afficheInscription() {

	document.getElementById("ajx_container").style.display = "block";
	document.body.style.overflow = "hidden";
	
	var params = 'ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_inscription.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});	
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_inscription.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
	
	document.getElementById("ajx_container").style.display="block";
}

function afficheInviteInscription(email) {

	document.getElementById("ajx_container").style.display = "block";
	document.body.style.overflow = "hidden";
	
	var params = 'emailinvite='+email+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_inscription.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_inscription.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
	
	document.getElementById("ajx_container").style.display="block";
}

function sendInscription() { 

   //get the values form the form
	var nom = document.getElementById("nom").value;
	var prenom = document.getElementById("prenom").value;
	var email = document.getElementById("email").value;
	var email2 = document.getElementById("email2").value;
	var login = document.getElementById("login").value;
	var password = document.getElementById("password").value;
	var password2 = document.getElementById("password2").value;
	var idLangue = document.getElementById("idLangue").value;
	//place the values in a parameter as a name value pair: name=value
	var params = 'action=inscription&nom='+nom+'&prenom='+prenom+'&email='+email+'&email2='+email2+'&login='+login+'&password='+password+'&password2='+password2+'&idLangue='+idLangue+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_inscription.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_inscription.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
	
	document.getElementById("ajx_container").style.display="block";
}

function afficheUpdate() {

	document.getElementById("ajx_container").style.display = "block";
	document.body.style.overflow = "hidden";
	
	var params = 'ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_update.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_update.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
	
	document.getElementById("ajx_container").style.display="block";
}


function sendUpdate() { 
   //get the values form the form
	var nom = document.getElementById("nom").value;
	var prenom = document.getElementById("prenom").value;
	var email = document.getElementById("email").value;
	var email2 = document.getElementById("email2").value;
	var login = document.getElementById("login").value;
	var password = document.getElementById("password").value;
	var password2 = document.getElementById("password2").value;
	var idLangue = document.getElementById("idLangue").value;
	//place the values in a parameter as a name value pair: name=value
	var params = 'action=update&nom='+nom+'&prenom='+prenom+'&email='+email+'&email2='+email2+'&login='+login+'&password='+password+'&password2='+password2+'&idLangue='+idLangue+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_inscription.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_inscription.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
	
	document.getElementById("ajx_container").style.display="block";
}

function renvoiMailActivation()
{
	var params = 'ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_renvoimailactivation.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_renvoimailactivation.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);*/
}

function afficheAjoutTel(typetel) {

	var params = 'element=' + typetel + '&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_afficheajouttel.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#afficheAjout_' + typetel ).html(data);
		}
	});
	
	/*new Ajax.Updater(
		'afficheAjout_' + typetel,
		'/apps/client/templates/includes/ajx_afficheajouttel.tpl.php', 
		{ 
			method: 'post', 
			parameters: params,
			asynchronous: true, 
			evalScripts : true
		}
	);*/
}

function ajoutTel(typetel)
{
	var value=document.getElementById(typetel).value;
	
	var params = 'element=' + typetel + '&value='+value+'&action=ajout&ajax=1';
	
	if(typetel=='TelMobilePro' || typetel=='TelFixePro')
	{
	
		jQuery.ajax({
			type: 'POST',
			processData: true,
			url: '/apps/client/templates/includes/ajx_ajouttel.tpl.php',
			data: params,
			dataType: 'html',
			success: function(data){
				majFichePro();
			}
		});
	
		/*new Ajax.Request(
			'/apps/client/templates/includes/ajx_ajouttel.tpl.php', 
			{ 
				method:'post', 
				parameters:params,
				asynchronous:true, 
				evalScripts : true,
				onComplete: majFichePro 
			}
		);*/
	
	} else if(typetel=='TelMobilePerso' || typetel=='TelFixePerso') {
		
		jQuery.ajax({
			type: 'POST',
			processData: true,
			url: '/apps/client/templates/includes/ajx_ajouttel.tpl.php',
			data: params,
			dataType: 'html',
			success: function(data){
				majFichePerso();
			}
		});
		
		/*new Ajax.Request(
			'/apps/client/templates/includes/ajx_ajouttel.tpl.php', 
			{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePerso 
			}
		);*/
	}
		
}

function afficheAjoutEmail(typemail)
{
	var params = 'element=' + typemail + '&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_afficheajoutemail.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#afficheAjout_' + typemail ).html(data);
		}
	});
	
	/*new Ajax.Updater(
		'afficheAjout_'+typemail,
		'/apps/client/templates/includes/ajx_afficheajoutemail.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);*/
}

function ajoutEmail(typemail)
{
	document.getElementById("ajx_container").style.display="block";
	document.body.style.overflow = "hidden";
	
	var value=document.getElementById(typemail).value;
	var params = 'element='+typemail+'&value='+value+'&action=ajout&ajax=1';
	
	if(typemail=='EmailPerso')
	{
		jQuery.ajax({
			type: 'POST',
			processData: true,
			url: '/apps/client/templates/includes/ajx_ajoutemail.tpl.php',
			data: params,
			dataType: 'html',
			success: function(data){
				jQuery('#ajx_container').html(data);
			},
			complete: function(){
				majFichePerso();
			}
		});
		
		/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_ajoutemail.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePerso 
		});*/
	}
	else
	{
		jQuery.ajax({
			type: 'POST',
			processData: true,
			url: '/apps/client/templates/includes/ajx_ajoutemail.tpl.php',
			data: params,
			dataType: 'html',
			success: function(data){
				jQuery('#ajx_container').html(data);
			},
			complete: function(){
				majFichePro();
			}
		});
		
		/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_ajoutemail.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePro 
		});*/
	}
}

function afficheAjoutSite(typesite) {

	var params = 'element=' + typesite + '&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_afficheajoutsite.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#afficheAjout_' + typesite ).html(data);
		}
	});
	
	/*new Ajax.Updater(
		'afficheAjout_' + typesite,
		'/apps/client/templates/includes/ajx_afficheajoutsite.tpl.php', 
		{ 
			method: 'post', 
			parameters: params,
			asynchronous: true, 
			evalScripts : true
		}
	);*/
}

function ajoutSite(typesite)
{
	var value=encodeURIComponent(document.getElementById(typesite).value);
	
	var params = 'element=' + typesite + '&value='+value+'&action=ajout&ajax=1';
	
	if(typesite=='SitePro' || typesite=='SiteFavoriPro')
	{
	
		jQuery.ajax({
			type: 'POST',
			processData: true,
			url: '/apps/client/templates/includes/ajx_ajoutsite.tpl.php',
			data: params,
			dataType: 'html',
			success: function(data){
				majFichePro();
			}
		});
	
		/*new Ajax.Request(
			'/apps/client/templates/includes/ajx_ajoutsite.tpl.php', 
			{ 
				method:'post', 
				parameters:params,
				asynchronous:true, 
				evalScripts : true,
				onComplete: majFichePro 
			}
		);*/
	
	} else if(typesite=='SitePerso' || typesite=='SiteFavoriPerso') {
		
		jQuery.ajax({
			type: 'POST',
			processData: true,
			url: '/apps/client/templates/includes/ajx_ajoutsite.tpl.php',
			data: params,
			dataType: 'html',
			success: function(data){
				majFichePerso();
			}
		});
		
		/*new Ajax.Request(
			'/apps/client/templates/includes/ajx_ajoutsite.tpl.php', 
			{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePerso 
			}
		);*/
	}
		
}

function afficheChangementFichePerso(element, size)
{
	var params = 'element='+element+'&size='+size+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_affichechangementficheperso.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#afficheChangementFichePerso_' + element ).html(data);
		}
	});
	
	/*new Ajax.Updater(
		'afficheChangementFichePerso_'+element,
		'/apps/client/templates/includes/ajx_affichechangementficheperso.tpl.php', 
		{ method:'post', parameters:params, asynchronous:true, evalScripts : true});*/
}




function changementFichePerso(element)
{
	var value=encodeURIComponent(document.getElementById(element).value);
	var params = 'element='+element+'&value='+value+'&ajax=1&action=modify';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_changementficheperso.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			majFichePerso();
		}
	});
	
	/*new Ajax.Request(
		'/apps/client/templates/includes/ajx_changementficheperso.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePerso
		}
	);*/
	
	var params2='type=perso';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_affiche_alerte.tpl.php',
		data: params2,
		dataType: 'html',
		success: function(data){
			jQuery('#bton_alerte_perso').html(data);
		}
	});
	
	/*new Ajax.Updater('bton_alerte_perso',
		'/apps/client/templates/includes/ajx_affiche_alerte.tpl.php', 
		{ 
			method:'post', 
			parameters:params2,
			asynchronous:true, 
			evalScripts : true
		}
	);*/
} 

function changementCompte(element)
{
	var value=encodeURIComponent(document.getElementById(element).value);
	var params = 'element='+element+'&value='+value+'&ajax=1&action=modify';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_changementcompte.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#container_' + element).html(data);
		}
	});
	
	/*new Ajax.Updater('container_'+element,
		'/apps/client/templates/includes/ajx_changementcompte.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true			
		}
	);*/
} 

function razFichePerso(element)
{
	var value="";
	var params = 'element='+element+'&value='+value+'&ajax=1&action=modify';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_changementficheperso.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			majFichePerso();
		}
	});
	
	/*new Ajax.Request(
		'/apps/client/templates/includes/ajx_changementficheperso.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePerso
		}
	);*/
} 

function majFichePerso(){

	afficheAjxLinksNetwork('perso');
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_fiche_perso.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#ficheperso').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ficheperso',
		'/apps/client/templates/includes/ajx_fiche_perso.tpl.php', 
		{ 
			method:'post', 
			asynchronous:true, 
			evalScripts:true
		}
	);*/
}

function majLiaisons(){

	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_toutesliaisons.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#liaisons').html(data);
		}
	});

	/*new Ajax.Updater(
		'liaisons',
		'/apps/client/templates/includes/ajx_toutesliaisons.tpl.php', 
		{ 
			method: 'post', 
			asynchronous:true, 
			evalScripts : true,
			onComplete: function() {
			}
		}
	);*/	
}

function afficheChangementFichePro(element, size) {

	var params = 'element=' + element + '&size=' + size + '&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_affichechangementfichepro.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#afficheChangementFichePro_' + element ).html(data);
		}
	});
	
	/*new Ajax.Updater(
		'afficheChangementFichePro_'+element,
		'/apps/client/templates/includes/ajx_affichechangementfichepro.tpl.php', 
		{ 
			method:'post', 
			parameters:params, 
			asynchronous:true, 
			evalScripts:true
		}
	);*/
}

function changementFichePro(element) {

	var value=encodeURIComponent(document.getElementById(element).value);
	var params = 'element='+element+'&value='+value+'&ajax=1&action=modify';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_changementfichepro.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		},
		complete: function(){
			majFichePro();
		}
	});
	
	/*new Ajax.Updater('ajx_container',
		'/apps/client/templates/includes/ajx_changementfichepro.tpl.php', 
		{ 
			method:'post', 
			parameters:params, 
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePro
		}
	);*/
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_changementfichepro.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			majFichePro();
		}
	});
	
	/*new Ajax.Request(
		'/apps/client/templates/includes/ajx_changementfichepro.tpl.php', 
		{ 
			method:'post', 
			parameters:params, 
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePro
		}
	);*/
	
	var params2 = 'type=pro';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_affiche_alerte.tpl.php',
		data: params2,
		dataType: 'html',
		success: function(data){
			jQuery('#bton_alerte_pro').html(data);
		}
	});
	
	/*new Ajax.Updater('bton_alerte_pro',
		'/apps/client/templates/includes/ajx_affiche_alerte.tpl.php', 
		{ 
			method:'post', 
			parameters:params2,
			asynchronous:true, 
			evalScripts : true
		}
	);*/
} 

function razFichePro(element) {

	var value=""
	var params = 'element='+element+'&value='+value+'&ajax=1&action=modify';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_changementfichepro.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			majFichePro();
		}
	});
	
	/*new Ajax.Request(
		'/apps/client/templates/includes/ajx_changementfichepro.tpl.php', 
		{ 
			method:'post', 
			parameters:params, 
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePro
		}
	);*/
} 

function majFichePro(){

	afficheAjxLinksNetwork('pro');
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_fiche_pro.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#fichepro').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'fichepro',
		'/apps/client/templates/includes/ajx_fiche_pro.tpl.php', 
		{ 
			method:'post', 
			asynchronous:true, 
			evalScripts : true
		}
	);*/
}

function afficheChangementCompte(element, size)
{
	var params = 'element='+element+'&size='+size+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_affichechangementcompte.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery( '#affiche_' + element ).html(data);
		}
	});
	
	/*new Ajax.Updater(
		'affiche_'+element,
		'/apps/client/templates/includes/ajx_affichechangementcompte.tpl.php', 
		{ method:'post', parameters:params, asynchronous:true, evalScripts : true});*/
}



function desactiveTel(typetel,id)
{
	var params = 'typetel='+typetel+'&id='+id+'&ajax=1';
	
	if(typetel=='TelFixePerso' || typetel=='TelMobilePerso'){
		
		jQuery.ajax({
			type: 'POST',
			processData: true,
			url: '/apps/client/templates/includes/ajx_desactivetel.tpl.php',
			data: params,
			dataType: 'html',
			success: function(data){
				majFichePerso();
			}
		});
	
		/*new Ajax.Request('/apps/client/templates/includes/ajx_desactivetel.tpl.php', {
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePerso			
			});*/
	
	} else {
	
		jQuery.ajax({
			type: 'POST',
			processData: true,
			url: '/apps/client/templates/includes/ajx_desactivetel.tpl.php',
			data: params,
			dataType: 'html',
			success: function(data){
				majFichePro();
			}
		});
	
		/*new Ajax.Request('/apps/client/templates/includes/ajx_desactivetel.tpl.php', {
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePro			
			});	*/
	}
}

function AfficheModifyTel(typetel,id)
{
	var params = 'typetel='+typetel+'&id='+id+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_affichemodifytel.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery( '#' + typetel + '_' + id ).html(data);
		}
	});
	
	/*new Ajax.Updater(typetel+'_'+id,
	'/apps/client/templates/includes/ajx_affichemodifytel.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
}

function ModifyTel(typetel,id)
{
	var numero=document.getElementById('numero').value;	
	var params = 'typetel='+typetel+'&id='+id+'&numero='+numero+'&ajax=1';
	
	if(typetel=='TelFixePerso' || typetel=='TelMobilePerso')
	{
		jQuery.ajax({
			type: 'POST',
			processData: true,
			url: '/apps/client/templates/includes/ajx_modifytel.tpl.php',
			data: params,
			dataType: 'html',
			success: function(data){
				majFichePerso();
			}
		});
	
		/*new Ajax.Request('/apps/client/templates/includes/ajx_modifytel.tpl.php', {
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePerso			
			});*/
	}
	else
	{
		jQuery.ajax({
			type: 'POST',
			processData: true,
			url: '/apps/client/templates/includes/ajx_modifytel.tpl.php',
			data: params,
			dataType: 'html',
			success: function(data){
				majFichePro();
			}
		});
	
		/*new Ajax.Request('/apps/client/templates/includes/ajx_modifytel.tpl.php', {
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePro			
			});	*/
	}
}


function desactiveMail(typemail,id) {

	var params = 'typemail='+typemail+'&id='+id+'&ajax=1';
	
	if(typemail=='MailPerso')
	{
		jQuery.ajax({
			type: 'POST',
			processData: true,
			url: '/apps/client/templates/includes/ajx_desactivemail.tpl.php',
			data: params,
			dataType: 'html',
			success: function(data){
				majFichePerso();
			}
		});
	
		/*new Ajax.Request('/apps/client/templates/includes/ajx_desactivemail.tpl.php', { 
		method:'post', 
		parameters:params,
		asynchronous:true, 
		evalScripts : true,
		onComplete: majFichePerso		
		});*/

	}
	else
	{
		jQuery.ajax({
			type: 'POST',
			processData: true,
			url: '/apps/client/templates/includes/ajx_desactivemail.tpl.php',
			data: params,
			dataType: 'html',
			success: function(data){
				majFichePro();
			}
		});
	
		/*new Ajax.Request('/apps/client/templates/includes/ajx_desactivemail.tpl.php', { 
		method:'post', 
		parameters:params,
		asynchronous:true, 
		evalScripts : true,
		onComplete: majFichePro
		});	*/	
	}

}

function deleteSite(typesite,id)
{
	var params = 'typesite='+typesite+'&id='+id+'&ajax=1';
	
	if(typesite=='SitePerso' || typesite=='SiteFavoriPerso')
	{
		jQuery.ajax({
			type: 'POST',
			processData: true,
			url: '/apps/client/templates/includes/ajx_deletesite.tpl.php',
			data: params,
			dataType: 'html',
			success: function(data){
				majFichePerso();
			}
		});
	
		/*new Ajax.Request('/apps/client/templates/includes/ajx_deletesite.tpl.php', {
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePerso			
			});*/
	}
	else
	{
		jQuery.ajax({
			type: 'POST',
			processData: true,
			url: '/apps/client/templates/includes/ajx_deletesite.tpl.php',
			data: params,
			dataType: 'html',
			success: function(data){
				majFichePro();
			}
		});
	
		/*new Ajax.Request('/apps/client/templates/includes/ajx_deletesite.tpl.php', {
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true,
			onComplete: majFichePro			
			});	*/
	}
}

function afficheCreationFichePerso() {

	document.getElementById("ajx_container").style.display = "block";
	document.body.style.overflow = "hidden";
	
	var params = 'ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_creationficheperso.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_creationficheperso.tpl.php', 
		{ 
			method:'post', 
			asynchronous:true, 
			evalScripts : true
		}
	);*/
}



function sendCreationFichePerso() { 
    
	//get the values form the form
	var dateNaissance = document.getElementById("dateNaissance").value;
	var villeNaissance = document.getElementById("villeNaissance").value;
	var idPaysNaissance = document.getElementById("idPaysNaissance").value;
	var idNationalite = document.getElementById("idNationalite").value;
	var idStatutMatrimonial = document.getElementById("idStatutMatrimonial").value;
	var nombreEnfants = document.getElementById("nombreEnfants").value;
	var adresse = document.getElementById("adresse").value;
	var zipCode = document.getElementById("zipCode").value;
	var ville = document.getElementById("ville").value;
	var region = document.getElementById("region").value;
	var idPays = document.getElementById("idPays").value;
	var facebook = encodeURIComponent(document.getElementById("facebook").value);
	var livemessenger = document.getElementById("livemessenger").value;
	var skype = document.getElementById("skype").value;
	var yahoomessenger = document.getElementById("yahoomessenger").value;
	var icq = document.getElementById("icq").value;
	var aim = document.getElementById("aim").value;
	var googletalk = document.getElementById("googletalk").value;
	var twitter = encodeURIComponent(document.getElementById("twitter").value);
	var myspace = encodeURIComponent(document.getElementById("myspace").value);
	
	
	//place the values in a parameter as a name value pair: name=value
	var params = 'action=creation&dateNaissance='+dateNaissance+'&villeNaissance='+villeNaissance+'&idPaysNaissance='+idPaysNaissance+'&idNationalite='+idNationalite+'&idStatutMatrimonial='+idStatutMatrimonial+'&nombreEnfants='+nombreEnfants+'&adresse='+adresse+'&zipCode='+zipCode+'&ville='+ville+'&region='+region+'&idPays='+idPays+'&facebook='+facebook+'&livemessenger='+livemessenger+'&skype='+skype+'&yahoomessenger='+yahoomessenger+'&icq='+icq+'&aim='+aim+'&googletalk='+googletalk+'&twitter='+twitter+'&myspace='+myspace+'&ajax=1'
	;
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_creationficheperso.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_creationficheperso.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
	
	document.getElementById("ajx_container").style.display="block";
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_mytag.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#mytag').html(data);
		}
	});
	
	//new Ajax.Updater('mytag','/apps/client/templates/includes/ajx_mytag.tpl.php', { method:'post', asynchronous:true, evalScripts : true});

}

function afficheCreationFichePro() {

	document.getElementById("ajx_container").style.display = "block";
	document.body.style.overflow = "hidden";

	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_creationfichepro.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_creationfichepro.tpl.php', 
		{ 
			method:'post', 
			asynchronous:true, 
			evalScripts : true
		}
	);*/
}



function sendCreationFichePro() { 
   //get the values form the form
   
   
	var profession = document.getElementById("profession").value;
	var entreprise = document.getElementById("entreprise").value;
	var idSecteur = document.getElementById("idSecteur").value;
	var idDepartement = document.getElementById("idDepartement").value;	
	var adresse = document.getElementById("adresse").value;
	var zipCode = document.getElementById("zipCode").value;
	var ville = document.getElementById("ville").value;
	var region = document.getElementById("region").value;
	var idPays = document.getElementById("idPays").value;
	var facebook = encodeURIComponent(document.getElementById("facebook").value);
	var livemessenger = document.getElementById("livemessenger").value;
	var skype = document.getElementById("skype").value;
	var yahoomessenger = document.getElementById("yahoomessenger").value;
	var icq = document.getElementById("icq").value;
	var aim = document.getElementById("aim").value;
	var googletalk = document.getElementById("googletalk").value;
	var twitter = encodeURIComponent(document.getElementById("twitter").value);
	var myspace = encodeURIComponent(document.getElementById("myspace").value);
	//place the values in a parameter as a name value pair: name=value
	
	var params = 'action=creation&profession='+profession+'&entreprise='+entreprise+
	'&idSecteur='+idSecteur+'&idDepartement='+idDepartement+'&adresse='+adresse+
	'&zipCode='+zipCode+'&ville='+ville+'&region='+region+'&idPays='+idPays+
	'&facebook='+facebook+'&livemessenger='+livemessenger+'&skype='+skype+'&yahoomessenger='+yahoomessenger+'&icq='+icq+'&aim='+aim+'&googletalk='+googletalk+'&twitter='+twitter+'&myspace='+myspace+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_creationfichepro.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_creationfichepro.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
	
	document.getElementById("ajx_container").style.display="block";
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_mytag.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#mytag').html(data);
		}
	});
	
	//new Ajax.Updater('mytag','/apps/client/templates/includes/ajx_mytag.tpl.php', { method:'post', asynchronous:true, evalScripts : true});

}
// fonctions invitations et gestion contacts


function MajListeContacts(){
	
	var params = 'ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_liaisons.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#liste_contacts').html(data);
		}
	});
	
	/*new Ajax.Updater('liste_contacts','apps/client/templates/includes/ajx_liaisons.tpl.php', 
	{ method:'post', parameters:params, asynchronous:true, evalScripts : true});*/
}


function MajListeInvitations(){

	var params = 'ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_invitationsliaisons.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#liste_invitations').html(data);
		}
	});
	
	/*new Ajax.Updater('liste_invitations','apps/client/templates/includes/ajx_invitationsliaisons.tpl.php', 
	{ method:'post',parameters:params, asynchronous:true, evalScripts : true});*/
}

function AfficheInvitation() {

	document.getElementById("ajx_container").style.display="block";
	document.body.style.overflow = "hidden";

	var params = 'ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_invitation.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_invitation.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);*/
}

function SendInvitation() { 
    
	myn = document.forms["invitation"].elements["moyen"];
	
	if( myn[0].checked )
		moyen = "tag";
	else
		moyen = "email";
	
	var valeur_tag = document.getElementById("valeur_tag").value;
	var valeur_email = document.getElementById("valeur_email").value;
	
	var params = 'action=creation&moyen=' + moyen + '&valeur_tag=' + valeur_tag + '&valeur_email=' + valeur_email + '&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_invitation.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_invitation.tpl.php', 
	{ 
		method:'post', 
		parameters:params,
		asynchronous:true, 
		evalScripts : true
	});*/
	
	document.getElementById("ajx_container").style.display="block";
}

function SendDirectInvitation(valeur_tag) { 
    
	moyen = "tag";	
	
	var params = 'action=creation&moyen=' + moyen + '&valeur_tag=' + valeur_tag + '&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_invitation.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_invitation.tpl.php', 
	{ 
		method:'post', 
		parameters:params,
		asynchronous:true, 
		evalScripts : true
	});*/
	
	document.getElementById("ajx_container").style.display="block";
}

function SendTagInvitation(type2) { 
    
	var type= "tag";
	var idUtilisateurDestinataire= document.getElementById("idUtilisateurDestinataire").value;
	var droitFichePerso = document.getElementById("droitFichePerso").value;
	var droitFichePro = document.getElementById("droitFichePro").value;
	var droitContact = document.getElementById("droitContact").value;	
	var typeInvitation= document.getElementById("typeInvitation").value;
	
	var params = 'idUtilisateurDestinataire='+idUtilisateurDestinataire+
	'&type='+type+
	'&droitFichePerso='+droitFichePerso+
	'&droitFichePro='+droitFichePro+
	'&droitContact='+droitContact+
	'&typeInvitation='+typeInvitation+
	'&type2='+type2+
	'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_sendinvitation.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
			majLiaisons();
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_sendinvitation.tpl.php', 
	{ 
		method:'post', 
		parameters:params,
		asynchronous:true, 
		evalScripts : true,
		onComplete:majLiaisons
	
	});*/
	
	document.getElementById("ajx_container").style.display="block";
	
}

function AccepteTagInvitation(idLiaison) { 
	
	//place the values in a parameter as a name value pair: name=value
	var params = 'idLiaison='+idLiaison+'&ajax=1';	
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_acceptetaginvitation.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		},
		complete : function() {
			majLiaisons();
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_acceptetaginvitation.tpl.php', 
	{ 
		method:'post', 
		parameters:params,
		asynchronous:true, 
		evalScripts : true,
		onComplete:majLiaisons
		
	});*/
	
	document.getElementById("ajx_container").style.display="block";
	
}

function RefuseTagInvitation(idLiaison) { 
	
	//place the values in a parameter as a name value pair: name=value
	var params = 'idLiaison='+idLiaison+'&ajax=1';	
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_refusetaginvitation.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			majLiaisons();
		}
	});
	
	/*new Ajax.Request('/apps/client/templates/includes/ajx_refusetaginvitation.tpl.php', 
	{ 
		method:'post', 
		parameters:params,
		asynchronous:true, 
		evalScripts : true,
		onComplete:majLiaisons
		
	});	*/
}


function SetAutorisationCroisee(){
	var action= "setAutorisation";	
	var idLiaisonCroisee= document.getElementById("idLiaisonCroisee").value;
	var droitFichePerso = document.getElementById("droitFichePerso").value;
	var droitFichePro = document.getElementById("droitFichePro").value;
	var droitContact = document.getElementById("droitContact").value;	
	
	var params = 'action='+action+'&idLiaisonCroisee='+idLiaisonCroisee+	
	'&droitFichePerso='+droitFichePerso+
	'&droitFichePro='+droitFichePro+
	'&droitContact='+droitContact+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_acceptetaginvitation.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		},
		complete: function(){
			majLiaisons();
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_acceptetaginvitation.tpl.php', 
	{ 
		method:'post', 
		parameters:params,
		asynchronous:true, 
		evalScripts : true,
		onComplete: MajListeContacts()
	});*/
	
	document.getElementById("ajx_container").style.display="block";
	
	
}

function SendEmailInvitation() { 
    var type="email";	
	var email=document.getElementById("email").value;
	var droitFichePerso = document.getElementById("droitFichePerso").value;
	var droitFichePro = document.getElementById("droitFichePro").value;
	var droitContact = document.getElementById("droitContact").value;
	var typeInvitation= document.getElementById("typeInvitation").value;		
	
	var params = 'email='+email+
	'&type='+type+
	'&droitFichePerso='+droitFichePerso+
	'&droitFichePro='+droitFichePro+
	'&droitContact='+droitContact+
	'&typeInvitation='+typeInvitation+	
	'&ajax=1';	
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_sendinvitation.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
			majLiaisons();
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_sendinvitation.tpl.php', 
	{ 
		method:'post', 
		parameters:params,
		asynchronous:true, 
		evalScripts : true
	});*/
	
	document.getElementById("ajx_container").style.display="block";	
}


function SendAlerte(fiche) {
	
	var params = 'fiche='+fiche+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_sendalerte.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_sendalerte.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});*/
	
	document.getElementById('bton_alerte_'+fiche).innerHTML='';
	document.getElementById("ajx_container").style.display="block";
}

function CancelAlerte(fiche) {
	document.getElementById('bton_alerte_'+fiche).innerHTML='';
}

function affichePhotoUploader() {

	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_uploadphoto.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});

	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_uploadphoto.tpl.php', 
		{ 
			method:'post', 
			evalScripts:true
		}
	);*/
	
	document.getElementById("ajx_container").style.display="block";
	document.body.style.overflow = "hidden";
}

function rechargePhoto() {

	jQuery('#cropfile').imgAreaSelect( {remove: true} );

	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_affichephoto.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#visuel').html(data);
		},
		complete: function(){
			emptyAjxContainer();
		}
	});
	
	/* Fermeture fenetre et maj visuel */
	/*new Ajax.Updater(
		'visuel',
		'/apps/client/templates/includes/ajx_affichephoto.tpl.php', 
		{ 
			method:'post', 
			asynchronous:true, 
			evalScripts:true,
			onComplete: emptyAjxContainer
		}
	);*/
}

function uploadthumbnail(x1, y1, w, h, extension, filename, width, height){
			
	var params = 'x1=' + x1 + '&y1=' + y1 + '&w=' + w + '&h=' + h + '&extension=' + extension + '&filename=' + filename + '&width=' + width + '&height=' + height;
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_upload_thumbnail.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			rechargePhoto();
		}
	});
	
	/* upload thumbnail + maj bdd */
	/*new Ajax.Request(
		'/apps/client/templates/includes/ajx_upload_thumbnail.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true,
			onComplete : rechargePhoto
		}
	);*/
}

function AfficheChangementEmail() {

	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_affichechangementemail.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});

	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_affichechangementemail.tpl.php', 
		{ 
			method:'post', 			
			asynchronous:true, 
			evalScripts:true
		}
	);*/
	
	document.getElementById("ajx_container").style.display="block";
	document.body.style.overflow = "hidden";
}

function ChangeEmail() {
	
	var email=document.getElementById("changecomptemail").value;
	var params = 'action=modifier&changemail='+email;
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_affichechangementemail.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_affichechangementemail.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});	*/
	
	document.getElementById("ajx_container").style.display="block";
}

function AfficheChangementNom() {

	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_affichechangementnom.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#changenom').html(data);
		}
	});

	/*new Ajax.Updater(
		'changenom',
		'/apps/client/templates/includes/ajx_affichechangementnom.tpl.php', 
		{ 
			method:'post', 			
			asynchronous:true, 
			evalScripts:true
		}
	);*/
}

function ChangeNom() {
	
	var nom=document.getElementById("changecomptenom").value;	
	var prenom=document.getElementById("changecompteprenom").value;	
	var params = 'action=modifier&changenom='+nom+'&changeprenom='+prenom;

	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_affichechangementnom.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#first').html(data);
		}
	});
	
	/*new Ajax.Updater('first','/apps/client/templates/includes/ajx_affichechangementnom.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});	*/
}



function ChangeDroit(element,id) {
	
	var params = 'element='+element+'&id='+id;

	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_changedroit.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#' + element + '_' + id ).html(data);
		},
		complete:function (){
			majAlerteLiaisons(id);
		}
	});
	
	/*new Ajax.Updater(element+'_'+id,'/apps/client/templates/includes/ajx_changedroit.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});	*/
}

function AfficheDeleteLiaison(id) {	

	var params = 'id='+id;
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_deleteliaison.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_deleteliaison.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});	*/
	
	document.getElementById("ajx_container").style.display="block";
}


function DeleteLiaison(id) {	

	var params = 'action=delete&id='+id;
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_deleteliaison.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		},
		complete: function(){
			majLiaisons();
		}
	});
	
	/*new Ajax.Updater
	(
		'ajx_container','/apps/client/templates/includes/ajx_deleteliaison.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true,
			onComplete: majLiaisons
		}
	);	*/
	
	document.getElementById("ajx_container").style.display="block";
}

function afficheResultatsRechercheLiaisons(){

	var string=document.getElementById("searchliaison").value;
	var params = 'action=recherche&string='+string;
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_liaisons.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#liste_contacts').html(data);
		}
	});
	
	/*new Ajax.Updater('liste_contacts','/apps/client/templates/includes/ajx_liaisons.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});	*/	

}


function InvitationCleanFieldAndFocus(myn)
{
	if(myn=="email")
	{
		document.getElementById('valeur_tag').value="";
		document.getElementById('valeur_email').focus();
		document.getElementById('moyen_email').checked=true; 
	}
	else
	{		
		document.getElementById('valeur_email').value="";
		document.getElementById('valeur_tag').focus();
		document.getElementById('moyen_tag').checked=true; 
	}
	

}

function msgActivation(){
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_activation.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_activation.tpl.php', 
		{ 
			method:'post', 
			asynchronous:true, 
			evalScripts : true
		}
	);	*/
	
	document.getElementById("ajx_container").style.display="block";
	document.body.style.overflow = "hidden";
}


function AfficheAddEmailToExistingAccount(email,idutilisateur)
{
	var params = 'email='+email+'&idutilisateur='+idutilisateur;	
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_addemailtoexistingaccount.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_addemailtoexistingaccount.tpl.php', 
		{ 
			method:'post',
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);*/
	
	document.getElementById("ajx_container").style.display="block";
	document.body.style.overflow = "hidden";
}

function addEmailAndAcceptInvitation()
{
	
	action="traitement";	
	typecompte = document.getElementById('typecompte').value;	
	acceptinvitation = document.getElementById('acceptinvitation').value;	
	droitperso = document.getElementById('droitperso').value;	
	droitpro = document.getElementById('droitpro').value;	
	droitcontacts = document.getElementById('droitcontacts').value;		
	email=document.getElementById('email').value;	
	idutilisateur=document.getElementById('idutilisateur').value;	
	params ='action='+action+
	'&email='+email+
	'&idutilisateur='+idutilisateur+
	'&typecompte='+typecompte+
	'&acceptinvitation='+acceptinvitation+
	'&droitperso='+droitperso+
	'&droitpro='+droitpro+
	'&droitcontacts='+droitcontacts;	
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_addemailtoexistingaccount.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_addemailtoexistingaccount.tpl.php', 
		{ 
			method:'post',
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);*/	
	
	document.getElementById("ajx_container").style.display="block";
	document.body.style.overflow = "hidden";
}

function AfficheImportationContacts()
{
	var params = 'ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_importationcontacts.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_importationcontacts.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);*/
	
	document.getElementById("ajx_container").style.display = "block";
	document.body.style.overflow = "hidden";
}



function AfficheOnlineContacts() {

	var params = 'action=affiche&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_onlinecontacts.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_onlinecontacts.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);*/
	
	document.getElementById("ajx_container").style.display = "block";
	document.body.style.overflow = "hidden";
}

function SendImportationParameters() {
	
	var email_box=document.getElementById('email_box').value;
	var password_box=document.getElementById('password_box').value;
	var provider_box=document.getElementById('provider_box').value;
	var step=document.getElementById('step').value;
	
	// Apparition du loader
	document.getElementById('loader').style.display = "block";
	
	var params = 
	'email_box='+email_box+
	'&password_box='+password_box+
	'&provider_box='+provider_box+
	'&step='+step+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_onlinecontacts.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		},
		complete : function() {
			setTimeout("document.getElementById('loader').style.display = 'none';", 2000);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_onlinecontacts.tpl.php', 
		{ 
			method:'post', 
			parameters: params,
			asynchronous: true, 
			evalScripts : true,
			onComplete : function() {
				setTimeout("document.getElementById('loader').style.display = 'none';", 2000);
			}
		}
	);*/
	
	document.getElementById("ajx_container").style.display = "block";
}

function InviteImportedContact(counter)
{
	var email=document.getElementById('email_'+counter).value;
	var type=document.getElementById('type_'+counter).value;
	var droitFichePro=document.getElementById('droitFichePro_'+counter).value;
	var droitFichePerso=document.getElementById('droitFichePerso_'+counter).value;
	var droitContacts=document.getElementById('droitContacts_'+counter).value;
	
	var params = 
	'email='+email+
	'&type='+type+
	'&droitFichePro='+droitFichePro+
	'&droitFichePerso='+droitFichePerso+
	'&droitContacts='+droitContacts+	
	'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_inviteimportedcontact.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#contact_' + counter ).html(data);
		}
	});
	
	/*new Ajax.Updater(
		'contact_'+counter,
		'/apps/client/templates/includes/ajx_inviteimportedcontact.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);*/

}

function SendMassInvitation(type)
{
	var compteur;
	var check = [];

	if(type=='online')
	{
		cpt = document.getElementById('listeContacts').elements["email"].length;
	
		for (i = 0; i < cpt; i++) { 
			compteur=compteur+"-"+i+"-";
			if( document.getElementById('listeContacts').elements["check"][i].checked == true ) {
				check.push("1"); 
			} else {
				check.push("0"); 
			}	
		}
		
		var modeInvitation = [];
		for (i = 0; i < cpt; i++) { modeInvitation.push( document.getElementById('listeContacts').elements["modeInvitation"][i].value ); }
		
		
		var email = [];
		for (i = 0; i < cpt; i++) { email.push( document.getElementById('listeContacts').elements["email"][i].value ); }
		
		var type = [];
		for (i = 0; i < cpt; i++) { type.push( document.getElementById('listeContacts').elements["type"][i].value ); }
		
		
		var droitFichePro = [];
		for (i = 0; i < cpt; i++) { 
			
			if( document.getElementById('listeContacts').elements["droitFichePro"][i].checked == true ) {
				droitFichePro.push("1"); 
			} else {
				droitFichePro.push("0"); 
			}	
		}
		
		var droitFichePerso = [];
		for (i = 0; i < cpt; i++) { 
			
			if( document.getElementById('listeContacts').elements["droitFichePerso"][i].checked == true ) {
				droitFichePerso.push("1"); 
			} else {
				droitFichePerso.push("0"); 
			}	
		}
		
		var droitContacts = [];
		for (i = 0; i < cpt; i++) { 
			
			/*if( document.getElementById('listeContacts').elements["droitContacts"][i].checked == true ) {
				droitContacts.push("1"); 
			} else {
				droitContacts.push("0"); 
			}
*/			
			droitContacts.push("0"); 
		}
	}
	else
	{
		cpt = document.getElementById("upload_target").contentDocument.getElementById('listeContacts').elements["email"].length;
	
		for (i = 0; i < cpt; i++) { 
			compteur=compteur+"-"+i+"-";
			if( document.getElementById("upload_target").contentDocument.getElementById('listeContacts').elements["check"][i].checked == true ) {
				check.push("1"); 
			} else {
				check.push("0"); 
			}	
		}
		
		var modeInvitation = [];
		for (i = 0; i < cpt; i++) { modeInvitation.push( document.getElementById("upload_target").contentDocument.getElementById('listeContacts').elements["modeInvitation"][i].value ); }
		
		
		var email = [];
		for (i = 0; i < cpt; i++) { email.push( document.getElementById("upload_target").contentDocument.getElementById('listeContacts').elements["email"][i].value ); }
		
		var type = [];
		for (i = 0; i < cpt; i++) { type.push( document.getElementById("upload_target").contentDocument.getElementById('listeContacts').elements["type"][i].value ); }
		
		
		var droitFichePro = [];
		for (i = 0; i < cpt; i++) { 
			
			if( document.getElementById("upload_target").contentDocument.getElementById('listeContacts').elements["droitFichePro"][i].checked == true ) {
				droitFichePro.push("1"); 
			} else {
				droitFichePro.push("0"); 
			}	
		}
		
		var droitFichePerso = [];
		for (i = 0; i < cpt; i++) { 
			
			if( document.getElementById("upload_target").contentDocument.getElementById('listeContacts').elements["droitFichePerso"][i].checked == true ) {
				droitFichePerso.push("1"); 
			} else {
				droitFichePerso.push("0"); 
			}	
		}
		
		var droitContacts = [];
		for (i = 0; i < cpt; i++) { 
			
			/*if( document.getElementById("upload_target").contentDocument.getElementById('listeContacts').elements["droitContacts"][i].checked == true ) {
				droitContacts.push("1"); 
			} else {
				droitContacts.push("0"); 
			}*/	
			droitContacts.push("0"); 
		}
	}
	
	var params = 
	'modeInvitation=' + modeInvitation +
	'&check=' + check +
	'&email=' + email +
	'&type=' + type +
	'&droitFichePro=' + droitFichePro +
	'&droitFichePerso=' + droitFichePerso +
	'&droitContacts=' + droitContacts +	
	'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_sendmassinvitation.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater('ajx_container',
	'/apps/client/templates/includes/ajx_sendmassinvitation.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});	*/
}


function SendMassInvitation_SUSPENDED(type)
{
	cpt = document.getElementById('listeContacts').elements["email"].length;
	
	var check = [];
	for (i = 0; i < cpt; i++) { 
		
		if( document.getElementById('listeContacts').elements["check"][i].checked == true ) {
			check.push("1"); 
		} else {
			check.push("0"); 
		}	
	}
	
	var modeInvitation = [];
	for (i = 0; i < cpt; i++) { modeInvitation.push( document.getElementById('listeContacts').elements["modeInvitation"][i].value ); }
	
	
	var email = [];
	for (i = 0; i < cpt; i++) { email.push( document.getElementById('listeContacts').elements["email"][i].value ); }
	
	var type = [];
	for (i = 0; i < cpt; i++) { type.push( document.getElementById('listeContacts').elements["type"][i].value ); }
	
	
	var droitFichePro = [];
	for (i = 0; i < cpt; i++) { 
		
		if( document.getElementById('listeContacts').elements["droitFichePro"][i].checked == true ) {
			droitFichePro.push("1"); 
		} else {
			droitFichePro.push("0"); 
		}	
	}
	
	var droitFichePerso = [];
	for (i = 0; i < cpt; i++) { 
		
		if( document.getElementById('listeContacts').elements["droitFichePerso"][i].checked == true ) {
			droitFichePerso.push("1"); 
		} else {
			droitFichePerso.push("0"); 
		}	
	}
	
	var droitContacts = [];
	for (i = 0; i < cpt; i++) { 
		
		/*if( document.getElementById('listeContacts').elements["droitContacts"][i].checked == true ) {
			droitContacts.push("1"); 
		} else {
			droitContacts.push("0"); 
		}*/
		droitContacts.push("0"); 		
	}
	
	var params = 
	'modeInvitation=' + modeInvitation +
	'&check=' + check +
	'&email=' + email +
	'&type=' + type +
	'&droitFichePro=' + droitFichePro +
	'&droitFichePerso=' + droitFichePerso +
	'&droitContacts=' + droitContacts +	
	'&ajax=1';

	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_sendmassinvitation.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater('ajx_container','/apps/client/templates/includes/ajx_sendmassinvitation.tpl.php', 
	{ method:'post', parameters:params,asynchronous:true, evalScripts : true});	*/
}

function AfficheCsvContacts() {

	var params = 'action=affiche&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_csvcontacts.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_csvcontacts.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);*/
	
	document.getElementById("ajx_container").style.display = "block";
	document.body.style.overflow = "hidden";
}

function AfficheLoader() {

	document.getElementById('f1_upload_process').style.display = 'block';
	setTimeout("document.getElementById('f1_upload_process').style.display = 'none';",2000);

	document.getElementById('upload_target').style.width = "750px";
	document.getElementById('upload_target').style.height = "500px";
	
	document.getElementById('fancy_outer').style.width = "825px";
	document.getElementById('fancy_outer').style.height = "500px";
	
	document.getElementById('f1_upload_form').style.display = 'none';	
}

function affichePresentation(){
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_presentation.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_presentation.tpl.php', 
		{ 
			method:'post', 
			asynchronous:true, 
			evalScripts : true
		}
	);*/
	
	document.getElementById("ajx_container").style.display = "block";
	document.body.style.overflow = "hidden";
} 

function afficheSecurite(){
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_securite.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_securite.tpl.php', 
		{ 
			method:'post', 
			asynchronous:true, 
			evalScripts : true
		}
	);*/
	
	document.getElementById("ajx_container").style.display = "block";
	document.body.style.overflow = "hidden";
} 

function afficheMentions(){
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_mentions.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_mentions.tpl.php', 
		{ 
			method:'post', 
			asynchronous:true, 
			evalScripts : true
		}
	);*/
	
	document.getElementById("ajx_container").style.display = "block";
	document.body.style.overflow = "hidden";
} 

function afficheInfos(){
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_infos.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_mentions.tpl.php', 
		{ 
			method:'post', 
			asynchronous:true, 
			evalScripts : true
		}
	);*/
	
	document.getElementById("ajx_container").style.display = "block";
	document.body.style.overflow = "hidden";
} 

function showinfos( id, img ){

	if (jQuery('#' + id).is(":visible")) {
	
		jQuery('#' + id).fadeOut("slow", function(){
			jQuery('#' + id).slideUp('normal');
		});
		
		jQuery('#' + img).addClass("ouvrir");
		jQuery('#' + img).removeClass("fermer");
		jQuery('#' + img).html("Ouvrir");
		
	} else {

		jQuery('#' + id).fadeOut("fast", function(){
			jQuery('#' + id).slideDown('normal');
		});
		
		jQuery('#' + img).removeClass("ouvrir");
		jQuery('#' + img).addClass("fermer");
		jQuery('#' + img).html("Fermer");
	}

}

function showapercu(){
	
	if( document.getElementById('typeInvitation').options[document.getElementById('typeInvitation').selectedIndex].value == "perso" ) {
		document.getElementById('apercu_perso').style.display = "block";
	} else {
		document.getElementById('apercu_pro').style.display = "block";
	}
	
}

function majCompteur(){

	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_compteur.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#nbr').html(data);
		}
	});
}

function compteur(){
	var timer=setInterval("majCompteur()", 1000);
}	

function majListeUserOnline(){

	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_online.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#online').html(data);
		}
	});
}

function online(){
	var timer=setInterval("majListeUserOnline()", 1000);
}	

function desactiveBouton(id)
{
	document.getElementById(id).innerHTML="<img src='/images/client/ajax-loader2.gif' alt='en cours'/>";
}


function afficheInvitationsUtilisateur(){
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_afficheinvitationsutilisateur.tpl.php',
		data: '',
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'ajx_container',
		'/apps/client/templates/includes/ajx_afficheinvitationsutilisateur.tpl.php', 
		{ 
			method:'post', 
			asynchronous:true, 
			evalScripts : true
		}
	);*/
	
	document.getElementById("ajx_container").style.display = "block";
	document.body.style.overflow = "hidden";
} 

function renvoiInvitationMail(id){
	
	type=document.getElementById("type_"+id).value;
	var params = 'id='+id+'&type='+type+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_renvoiinvitationmail.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#invitation_' + id ).html(data);
		}
	});
	
	/*new Ajax.Updater(
		'invitation_'+id,
		'/apps/client/templates/includes/ajx_renvoiinvitationmail.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);	*/
} 

function renvoiInvitationTag(id){
	
	type=document.getElementById("type_"+id).value;
	var params = 'id='+id+'&type='+type+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_renvoiinvitationtag.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#liaison_' + id ).html(data);
		}
	});
	
	/*new Ajax.Updater(
		'invitation_'+id,
		'/apps/client/templates/includes/ajx_renvoiinvitationmail.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);	*/
}

function cancelInvitation(typei,id){
	
	var params = 'id='+id+'&type='+typei+'&ajax=1';	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_cancelinvitation.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){			
			majLiaisons();
		}
	});	
} 


function afficheAjxLinksNetwork(type){
	
	var params = 'type='+type+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_links_network.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#big_favoris').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'big_favoris',
		'/apps/client/templates/includes/ajx_links_network.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);	*/
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_sitesfavoris.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#sites_favoris').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'slider',
		'/apps/client/templates/includes/ajx_sitesfavoris.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);	*/
} 

function afficheAjxLinksNetworkView(type,idu){
	
	var params = 'type=' + type + '&idu=' + idu + '&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_links_network_view.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#big_favoris').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'big_favoris',
		'/apps/client/templates/includes/ajx_links_network_view.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);	*/
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_sitesfavoris_view.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#sites_favoris').html(data);
		}
	});
	
	/*new Ajax.Updater(
		'sites_favoris',
		'/apps/client/templates/includes/ajx_sitesfavoris_view.tpl.php', 
		{ 
			method:'post', 
			parameters:params,
			asynchronous:true, 
			evalScripts : true
		}
	);	*/
} 


function majAlerteLiaisons(idLiaison){
	
	var params = 'idLiaison='+idLiaison;
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_checkdroitexists.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#alerte_'+idLiaison).html(data);
		}
	});
}


function afficheRenvoiIdentifiants() {

	var params = 'ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_afficherenvoiidentifiants.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});	
	document.getElementById("ajx_container").style.display="block";
}

function renvoiIdentifiants() {

	var email=document.getElementById('email').value;
	var params = 'email='+email+'&ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_afficherenvoiidentifiants.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});	
	document.getElementById("ajx_container").style.display="block";
}

function MajMessagerie(){
	
	var params = 'ajax=1';
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_messagerie.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#messagerie').html(data);
		}
	});
	
	/*new Ajax.Updater('liste_contacts','apps/client/templates/includes/ajx_liaisons.tpl.php', 
	{ method:'post', parameters:params, asynchronous:true, evalScripts : true});*/
}

function afficheMp(idDestinataire) {

	var params = 'ajax=1&idDestinataire='+idDestinataire;
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_mp.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
			
		}
	});	
	document.getElementById("ajx_container").style.display="block";
}

function SendMp() {

	
	var idDestinataire=document.getElementById('idDestinataire').value;
	var titre=document.getElementById('titre').value;
	var message=encodeURIComponent(document.getElementById('message').value);
	
	
	var params = 'ajax=1&action=envoi&idDestinataire='+idDestinataire+'&titre='+titre+'&message='+message;
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_mp.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
			MajMessagerie();
		}
	});	
	document.getElementById("ajx_container").style.display="block";
}

function deleteOnline( idSession){
	
	var params = 'idSession='+idSession;
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_delete_online.tpl.php',
		data: params,
		dataType: 'html'
	});	
	
}





function readMp(idMp) {

	var params = 'ajax=1&idMp='+idMp;
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_affiche_mp.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
			MajMessagerie();
		}
	});	
	document.getElementById("ajx_container").style.display="block";
}
function readSentMp(idMp) {

	var params = 'ajax=1&idMp='+idMp;
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_affiche_sent_mp.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
			MajMessagerie();
		}
	});	
	document.getElementById("ajx_container").style.display="block";
}

function repondreMp(idMp) {

	var params = 'ajax=1&idMp='+idMp;
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_reponse_mp.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			jQuery('#ajx_container').html(data);
		}
	});	
	document.getElementById("ajx_container").style.display="block";
}

function deleteMp(idMp) {

	var params = 'ajax=1&idMp='+idMp;
	
	jQuery.ajax({
		type: 'POST',
		processData: true,
		url: '/apps/client/templates/includes/ajx_delete_mp.tpl.php',
		data: params,
		dataType: 'html',
		success: function(data){
			MajMessagerie();
		}
	});	
	
}
