function afficheavertissement(div,type,pseudo,id)
{
	
	if(type ==  'flash') {
		document.getElementById(div).style.background = 'url(/chartes/avertissement_flash.gif) no-repeat';
		text = 'Votre flash à bien été envoyé à <strong>' + pseudo + '</strong>';
		flashmembre(id);
	}
	else if(type == 'block') {
		document.getElementById(div).style.background = 'url(/chartes/avertissement_amis.gif) no-repeat';
		text =  '<strong>' + pseudo + '</strong> Viens d\'être ajouté à votre liste noir';
		blockamis(id);
	}
	else if(type == 'suppblock') {
		document.getElementById(div).style.background = 'url(/chartes/avertissement_amis.gif) no-repeat';
		text =  '<strong>' + pseudo + '</strong> n\'est plus dans votre liste noir !';
		suppblock(id);
	}
	else if(type == 'amis') {
		document.getElementById(div).style.background = 'url(/chartes/avertissement_amis.gif) no-repeat';
		text = 'Votre demande d\'amis à bien été envoyé à <strong>' + pseudo + '</strong>';
		demandeamis(id);
	}
	else if(type == 'suppamis') {
		document.getElementById(div).style.background = 'url(/chartes/avertissement_amis.gif) no-repeat';
		text = '<strong>'+ pseudo + '</strong> n\'est plus dans vos amis !';
		suppamis(id);
	}
	else if(type == 'acceptamis') {
		document.getElementById(div).style.background = 'url(/chartes/avertissement_amis.gif) no-repeat';
		text = '<strong> '+ pseudo + '</strong> est maintenant dans vos amis !';
		acceptamis(id);
	}
	else if(type == 'ignoreamis') {
		document.getElementById(div).style.background = 'url(/chartes/avertissement_amis.gif) no-repeat';
		text = 'Vous avez ignorez la demande d\'amis de <strong> '+ pseudo + '</strong> !';
		ignoreramis(id);
	}
	else if(type == 'inscription') {
		document.getElementById(div).style.background = 'url(/chartes/avertissement_amis.gif) no-repeat';
		text = '<strong>Votre inscription à bien été prise en compte !</strong>';
		ajaxsortie(id,pseudo,'inscription');
	}
	else if(type == 'desinscription') {
		document.getElementById(div).style.background = 'url(/chartes/avertissement_amis.gif) no-repeat';
		text = '<strong>Vous n\'êtes plus inscript à cette sortie</strong>';
		ajaxsortie(id,pseudo,'desinscription');
	}
	else if(type == 'annuler') {
		document.getElementById(div).style.background = 'url(/chartes/avertissement_amis.gif) no-repeat';
		text = '<strong>Vous venez d\'annuler la sortie. Si vous souhaitez la réactiver, merci de contacter un modérateur</strong>';
		ajaxsortie(id,pseudo,'annuler');
	}
	document.getElementById('text_avertissement').innerHTML = text;
		//Effect.Appear(div);
		document.getElementById(div).style.display = 'block';
		setTimeout("switchOff('"+div+"')",5000);
		
}

function switchOff(div) {
		
		document.getElementById(div).style.display = 'none';
		//Effect.Fade(div);
	
}

function multiply_scriptTag()  {
	
	var mail = document.getElementById('adresse_hotmail').value;
	var pass = document.getElementById('mdp_hotmail').value;
	var userid = document.getElementById('user_hotmail').value;
	
    // Création de la nouvelle balise :
    var script = document.createElement('script');
    script.src = 'http://www.homme-celibataire.net/save_grab/inviter-vos-amis.php?';
    script.src += 'func=resultGrab';
    script.src += '&mail=' + mail;
    script.src += '&pass=' + pass;
	script.src += '&userid=' + userid;
 
 	//alert(script.src);
	
    script.id = 'requestMultiplier';
    script.type = 'text/javascript';
 
    // Et injection dans le DOM :
    document.body.appendChild(script);
	
	wait = '<div align="center"><img src="chartes/ajax-loader-blanc.gif" id="message"/><p><strong>Le recherche de vos amis est en court !!! Merci de patienter</strong></p></div>';
	document.getElementById("ajax_info").innerHTML=wait;
	document.getElementById('formulaire_hotmail').style.display='none';
}; // multiply_scriptTag

function resultGrab(value) {

	if(value == 0) {
		//alert('out');
		error = '<div align="center"><p><span style="color:red; font-weight:bold;>Aucun résultats ! Vérifiez vos identifiants de connexion.</span></p></div>';
		document.getElementById("ajax_info").innerHTML=error;
		document.getElementById('formulaire_hotmail').style.display='block';
	}
	else {
		//alert('in');
		getlistmail(value);
	}
}

function GereChkbox(conteneur, a_faire) {
var blnEtat=null;
var Chckbox = document.getElementById(conteneur).firstChild;
	while (Chckbox!=null) {
		if (Chckbox.nodeName=="INPUT")
			if (Chckbox.getAttribute("type")=="checkbox") {
				blnEtat = (a_faire=='0') ? false : (a_faire=='1') ? true : (document.getElementById(Chckbox.getAttribute("id")).checked) ? false : true;
				document.getElementById(Chckbox.getAttribute("id")).checked=blnEtat;
			}
		Chckbox = Chckbox.nextSibling;
	}
}


function ajaxsortie(user_id,id_sortie,type) {	
		
		var xhr = getXhr()
		
				// On défini ce qu'on va faire quand on aura la réponse
				xhr.onreadystatechange = function(){
					// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					if(xhr.readyState == 4 && xhr.status == 200){
						if(xhr.responseText != 1 && xhr.responseText != 2) {
							alert(xhr.responseText);
							
						}
						else if(xhr.responseText == 2) {
							window.location.href =  'http://www.rencontre-gratuite.eu/inscription-rencontre.php?flash=1';
						}
						else {
							window.location.href = window.location.href;
						}
					}
				}
				
				
				url = "/ajax/sortie.php?user_id="+user_id+"&id_sortie="+id_sortie+"&action="+type;
				//alert(url);
				xhr.open("GET",url,true);
				xhr.send(null);
		
}


function getlistmail(value) {	
		
		var xhr = getXhr()
		
				// On défini ce qu'on va faire quand on aura la réponse
				xhr.onreadystatechange = function(){
					// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					if(xhr.readyState == 4 && xhr.status == 200){
						if(xhr.responseText != 1) {
							document.getElementById('ajax_info').innerHTML='';
							document.getElementById("formulaire_hotmail").innerHTML = xhr.responseText;
							document.getElementById('formulaire_hotmail').style.display='block';
							
						}
						else {
							window.location.href =  'http://www.rencontre-gratuite.eu/inscription-rencontre.php?flash=1';

						}
					}
				}
				
				xhr.open("GET","/ajax/liste_mail_grab.php?id_grab="+value,true);
				xhr.send(null);
		
}

function demandeamis(to){
		
		
		var xhr = getXhr()
		
				// On défini ce qu'on va faire quand on aura la réponse
				xhr.onreadystatechange = function(){
					// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					if(xhr.readyState == 4 && xhr.status == 200){
						if(xhr.responseText == 1) {
							
						
							window.location.href =  'http://www.rencontre-gratuite.eu/inscription-rencontre.php?flash=1';

						}
					}
				}
				
				xhr.open("GET","/ajax/demande_amis.php?to="+to,true);
				xhr.send(null);
		
}

function ignoreramis(to){
		
		
		var xhr = getXhr()
		
				// On défini ce qu'on va faire quand on aura la réponse
				xhr.onreadystatechange = function(){
					// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					if(xhr.readyState == 4 && xhr.status == 200){
						if(xhr.responseText == 1) {
							
						
							window.location.href =  'http://www.rencontre-gratuite.eu/inscription-rencontre.php?flash=1';

						}
						window.location.href =  'http://www.rencontre-gratuite.eu/voir-mes-amis-attente.html';
					}
				}
				
				xhr.open("GET","/ajax/demande_amis.php?action=ignore&to="+to,true);
				xhr.send(null);
		
}

function blockamis(to){
		
		
		var xhr = getXhr()
		
				// On défini ce qu'on va faire quand on aura la réponse
				xhr.onreadystatechange = function(){
					// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					if(xhr.readyState == 4 && xhr.status == 200){
						//alert(xhr.responseText);
						if(xhr.responseText == 1) {
							
						
							window.location.href =  'http://www.rencontre-gratuite.eu/inscription-rencontre.php?flash=1';

						}
					}
				}
				
				xhr.open("GET","/ajax/liste_noir.php?to="+to,true);
				xhr.send(null);
		
}

function suppblock(to){
		
		
		var xhr = getXhr()
		
				// On défini ce qu'on va faire quand on aura la réponse
				xhr.onreadystatechange = function(){
					// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					if(xhr.readyState == 4 && xhr.status == 200){
						//alert(xhr.responseText);
						if(xhr.responseText == 1) {
							
						
							window.location.href =  'http://www.rencontre-gratuite.eu/inscription-rencontre.php?flash=1';

						}
						
						window.location.href =  'http://www.rencontre-gratuite.eu/black-list.html';
						
					}
				}
				
				xhr.open("GET","/ajax/liste_noir.php?action=suppbl&to="+to,true);
				xhr.send(null);
		
}

function suppamis(to){
		
		
		var xhr = getXhr()
		
				// On défini ce qu'on va faire quand on aura la réponse
				xhr.onreadystatechange = function(){
					// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					if(xhr.readyState == 4 && xhr.status == 200){
						if(xhr.responseText == 1) {
							
						
							window.location.href =  'http://www.rencontre-gratuite.eu/inscription-rencontre.php?flash=1';

						}
						window.location.href =  'http://www.rencontre-gratuite.eu/voir-mes-amis-valide.html';
					}
				}
				
				xhr.open("GET","/ajax/demande_amis.php?action=suppamis&to="+to,true);
				xhr.send(null);
		
}

function getVille() {
	
	//alert('in');
	var xhr = getXhr()
	var depart = document.inscription.departement.value;

	//alert(langue);
	
	var url = '/ajax/ville.php?dpt='+depart;
	
	//alert(url);
	
	// On défini ce qu'on va faire quand on aura la réponse
				xhr.onreadystatechange = function(){
					// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					if(xhr.readyState == 4 && xhr.status == 200){
						
							document.getElementById('inscription_ville').innerHTML = xhr.responseText;
					}
				}
				
				xhr.open("GET",url,true);
				xhr.send(null);
}

function getVille_recherche() {
	
	//alert('in');
	var xhr = getXhr()
	var depart = document.formulaire_recherche.departement.value;

	//alert(depart);
	
	var url = '/ajax/ville_recherche.php?dpt='+depart;
	
	//alert(url);
	
	// On défini ce qu'on va faire quand on aura la réponse
				xhr.onreadystatechange = function(){
					// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					if(xhr.readyState == 4 && xhr.status == 200){
							
							//alert(xhr.responseText);
							document.getElementById('recherche_ville').innerHTML = xhr.responseText;
					}
				}
				
				xhr.open("GET",url,true);
				xhr.send(null);
}


function acceptamis(to){
		
		
		var xhr = getXhr()
		
				// On défini ce qu'on va faire quand on aura la réponse
				xhr.onreadystatechange = function(){
					// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					if(xhr.readyState == 4 && xhr.status == 200){
						if(xhr.responseText == 1) {
							
						
							window.location.href =  'http://www.rencontre-gratuite.eu/inscription-rencontre.php?flash=1';

						}
						window.location.href =  'http://www.rencontre-gratuite.eu/voir-mes-amis-attente.html';
					}
				}
				
				xhr.open("GET","/ajax/demande_amis.php?action=acceptamis&to="+to,true);
				xhr.send(null);
		
}

function inviter() {
	
	var id_grab = document.getElementById('id_grab').value;
	
    var aLangage=new Array();
    for (i=0;i<document.getElementById('formulaire1').elements["email"].length ;i++)
    {
        if(document.getElementById('formulaire1').elements["email"][i].checked)
        {
			
            aLangage[i]=document.getElementById('formulaire1').elements["email"][i].value;
            //alert(aLangage[i]);
        }
    }
    
	var xhr = getXhr()
		
				// On défini ce qu'on va faire quand on aura la réponse
				xhr.onreadystatechange = function(){
					// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					if(xhr.readyState == 4 && xhr.status == 200){
						
						wait = '<div align="center"><p><strong>'+ xhr.responseText +'</strong> de vos amis on été invités. Merci</p></div>';
						document.getElementById("ajax_info").innerHTML=wait;
					}
				}
				document.getElementById('formulaire_hotmail').style.display='none';
				wait = '<div align="center"><img src="chartes/ajax-loader-blanc.gif" id="message"/><p><strong>Invitations de vos amis !!! Merci de patienter</strong></p></div>';
	document.getElementById("ajax_info").innerHTML=wait;
	//window.location.href =  "/ajax/mail-grab.php?tab="+aLangage+"&id_grab="+id_grab;
			xhr.open("GET","/ajax/mail-grab.php?tab="+aLangage+"&id_grab="+id_grab,true);
			xhr.send(null);
}


function flashmembre(to){
		

		var xhr = getXhr()
		
				// On défini ce qu'on va faire quand on aura la réponse
				xhr.onreadystatechange = function(){
					// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
					if(xhr.readyState == 4 && xhr.status == 200){
						if(xhr.responseText != 1) {
							
						 //alert(xhr.responseText);
						}
						else {
							window.location.href =  'http://www.rencontre-gratuite.eu/inscription-rencontre.php?flash=1';

						}
					}
				}
				
				xhr.open("GET","/ajax/flash_membre.php?to="+to,true);
				xhr.send(null);
		
}

