

// Test des navigateurs
var netscape = false;
var ie = false;
if (navigator.appName.substring(0,8) == "Netscape")
{
  netscape = true;
}
else if (navigator.appName.substring(0,9) == "Microsoft")
{
  ie = true;
}


// Retourne la version de IE
function version_ie()
{
    version = 0;
    // Test si le navigateur est IE
    if (navigator.appVersion.indexOf("MSIE") != -1)
    {
        // recupère la version de IE
        tableau_ie = navigator.appVersion.split("MSIE");
        version = parseFloat(tableau_ie[1]);
    }
    return version;
}


// Afficher un élement
function affiche(id_element)
{
    if(document.getElementById(id_element)){
		document.getElementById(id_element).style.display = 'block';
	}	
}


// Masquer un élement
function masque(id_element)
{
    if(document.getElementById(id_element)){
	    document.getElementById(id_element).style.display = 'none';
	}
}



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




// fonctions à appeler sur déplacement de la souris
var deplace_souris_fonctions = new Array();


// deplacement de la souris
function deplaceSouris(e)
{
	if(ie)
	{
		x = (ie) ? window.event.clientX : event.x + document.body.scrollLeft;
		y = (ie) ? window.event.clientY : event.y + document.body.scrollTop;
	}
	else if(netscape)
	{
		x = (netscape) ? e.pageX : event.x + document.body.scrollLeft;
		y = (netscape) ? e.pageY : event.y + document.body.scrollTop;
	}
	else
	{
		x = e.pageX + document.body.scrollLeft;
		y = e.pageY + document.body.scrollTop;
	}
  
	var fonc = "";
	for (i=0; i<deplace_souris_fonctions.length; i++){
		fonc = deplace_souris_fonctions[i];
		eval(fonc+'(\''+x+'\', \''+y+'\');');
	}

}

document.onmousemove = deplaceSouris;




// fonctions à appeler sur scrolling vertical
var vscroll_fonctions = new Array();

// test du scrolling vertical...
var vscroll_pos = 0;
function test_vscroll() {
	if(document.body.scrollTop != vscroll_pos) {
		vscroll_pos = document.body.scrollTop;
		var fonc = "";
		for (i=0; i<vscroll_fonctions.length; i++){
			fonc = vscroll_fonctions[i];
			eval(fonc+'();');
		}
	}
	setTimeout('test_vscroll()', 50);
}





function serialize (txt) {
	switch(typeof(txt)){
	case 'string':
		return 's:'+txt.length+':"'+txt+'";';
	case 'number':
		if(txt>=0 && String(txt).indexOf('.') == -1 && txt < 65536) return 'i:'+txt+';';
		return 'd:'+txt+';';
	case 'boolean':
		return 'b:'+( (txt)?'1':'0' )+';';
	case 'object':
		var i=0,k,ret='';
		for(k in txt){
			if(!isNaN(k)) k = Number(k);
			ret += serialize(k)+serialize(txt[k]);
			i++;
		}
		return 'a:'+i+':{'+ret+'}';
	default:
		return 'N;';
		alert('var undefined: '+typeof(txt));return undefined;
	}
}






function autoefface_init(id, texte) {
	if (document.getElementById(id).value == '') {
		document.getElementById(id).value = texte;
		document.getElementById(id+'_autoefface').value = 1;
	} else {
		document.getElementById(id+'_autoefface').value = 2;
	}
}

function autoefface_init_i(id, texte) {
	if (document.getElementById(id).value == '') {
		document.getElementById(id).style.fontStyle = 'italic';
		document.getElementById(id).value = texte;
		document.getElementById(id+'_autoefface').value = 1;
	} else {
		document.getElementById(id+'_autoefface').value = 2;
	}
}

function autoefface_focusg(champ) {
	if (document.getElementById(champ+'_autoefface').value == 1) {
		document.getElementById(champ).value = '';
	}
}

function autoefface_unfocusg(champ, texte) {
	if (document.getElementById(champ+'_autoefface').value == 1) {
		if (document.getElementById(champ).value == '') {
		} else {
			document.getElementById(champ+'_autoefface').value = 2;
		}
	}
	if (document.getElementById(champ+'_autoefface').value == 2) {
		if (document.getElementById(champ).value == '') {
			document.getElementById(champ+'_autoefface').value = 1;
		} else {
		}
	}
	if (document.getElementById(champ+'_autoefface').value == 1) {
		document.getElementById(champ).value = texte;
	}

}


// Remplacement des boutons "radio" par des images
function radio_img_clic(champ1, image1, image2, src1a, src1b, src2a, src2b, val)
{
	champ1.value = val;

	if (val=="1") {
			image1.src = src1a;
			image2.src = src2b;
	}

	if (val=="2") {
			image1.src = src1b;
			image2.src = src2a;
	}
}


// Remplacement des boutons "radio" par des images (5)
function radio_img5_clic(champ, image1, image2, image3, image4, image5, src1, src2, val)
{
	champ.value = val;
  
	image1.src = src1;
	image2.src = src2;
	image3.src = src2;
	image4.src = src2;
	image5.src = src2;
}


// Remplacement des boutons "checkbox" par des images
function checkbox_img_clic(champ, image, src1, src2) {
	if (champ.value=='1') {
		champ.value='';
		image.src=src1;
	} else {
		champ.value='1';
		image.src=src2;
	}
}




function masque_selects_ie6() {

	// recupère dans un tableau tous les "select" de la page
	var nb_select = document.getElementsByTagName("select");
	
	// Cache les "select" pour IE seulement
	if ((navigator.appName.substring(0,9) == "Microsoft") && (version_ie()<7))
	{
		for (i=0; i<=nb_select.length; i++)
		{
			if (document.getElementsByTagName("select")[i])
			{
				document.getElementsByTagName("select")[i].style.visibility = "hidden";
			}
		}
	}

}

function raffiche_selects_ie6() {

	// recupère dans un tableau tous les "select" de la page
	var nb_select = document.getElementsByTagName("select");
	
	// Cache les "select" pour IE seulement
	if ((navigator.appName.substring(0,9) == "Microsoft") && (version_ie()<7))
	{
		for (i=0; i<=nb_select.length; i++)
		{
			if (document.getElementsByTagName("select")[i])
			{
				document.getElementsByTagName("select")[i].style.visibility = "visible";
			}
		}
	}

}


// Verifie si un caractère est alphanumérique
function verif_alphanum(ch)
{
    if ( ((ch >= '0') && (ch <= '9')) || ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) )
        return true;
    else
        return false;
}


// Verifie si un caractère est numérique
function verif_numerique(ch)
{
    if ( ((ch >= '0') && (ch <= '9')) )
        return true;
    else
        return false;
}


// Verifie si une chaine est alphanumérique
function chaine_alphanum(chaine)
{
    var i = 0;
    
    for( i=0; i<chaine.length; i++ )
    {
        if (! verif_alphanum(chaine.charAt(i)))
        {
            return false;
        }
    }
    return true;
}


// Verifie si une chaine est numérique
function chaine_numerique(chaine)
{
    var i = 0;
    
    for( i=0; i<chaine.length; i++ )
    {
        if (! verif_numerique(chaine.charAt(i)))
        {
            return false;
        }
    }
    return true;
}


// Verification de la validite d'une adresse mail
function verif_mail_valide(email) {
	var proto = "(mailto:)?";
	var ident = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
	var domain = "([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";
	var adresse  = "^" + proto + "?" + ident + "\@" + domain + "$";
	
	// Si adresse OK, retourne true, sinon, retourne false
	var rgx = new RegExp(adresse);
	return rgx.exec(email) ? true : false;
}


// Verifie si une adresse mail est de type "airfrance" et "KLM"
function verif_mail_air_france(email) {
	var domain_af = "airfrance.fr";
 	var domain_klm1 = "klm.com";
	var domain_klm2 = "klmcargo.com";
	var domain_klm3 = "td.klm.com";	
	var domain_klm4 = "klmcabincrew.com";
	var domain_klm5 = "klmcabincrew.nl";	
	var p = email.indexOf("@") ; // Position du @ dans la chaîne mail
	var domaine = email.substr(p + 1) ; // On récupère le domaine (qui se trouve après le @)	
	if (domain_af == domaine) return true;
 	else if(domain_klm1 == domaine) return true;
	else if(domain_klm2 == domaine) return true;
	else if(domain_klm3 == domaine) return true; 
	else if(domain_klm4 == domaine) return true; 
	else if(domain_klm5 == domaine) return true; 
	else return false;
}
/* function verif_mail_air_france(email) {
	var proto = "(mailto:)?";
	var ident = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
	//var domain = "airfrance\\.fr";
	var domain = domain_mail_invit;
	if (domain){
		var adresse  = "^" + proto + "?" + ident + "\@" + domain + "$";
		// Si adresse OK, retourne true, sinon, retourne false
		var rgx = new RegExp(adresse);
		return rgx.exec(email) ? true : false;
	} else {
		return true;
	}
} */


function verif_pass_valide(pass) {

	var format = "([a-zA-Z0-9]{6})";

	// Si adresse OK, retourne true, sinon, retourne false
	var rgx = new RegExp(format);
	return rgx.exec(pass) ? true : false;
}




// Change l'image de la maison dans le menu
/*function changer_home(num,test)
{
	if( (document.images)&&(test == 0) )
	{
		tab_images = new Array();
		tab_images[0]= new Image();
		tab_images[1]= new Image();
		tab_images[0].src = 'images/accueil-off.gif';
		tab_images[1].src = 'images/accueil-on.gif';
	
		document.getElementById('home_maison').src = tab_images[num].src;
	}
}*/


function modconfirm2(callback) {
	modconfirm_back = callback;
	
	//var text = trlg("F97","Poursuivre sans sauvegarder les modifications effectuées");
	var text = '<div class="texta12 gras gris4" style="padding-top:20px;">'+trlg("D532","Souhaitez-vous quitter cette page")+' ?</div>';
	text += '<div class="texta11 gris4" style="margin-top:15px;">'+trlg("D533","Les informations données, les modifications effectuées ne seront pas prises en compte")+'.</div>';
	var quitter = '<img class="png_trans" src="images/triangle_grisfonce_droit.png" alt="" /> <span class="texta11 gras gris4">'+trlg("D534","quitter")+'</span>';
	var annuler = '<img class="png_trans" src="images/triangle_gris_gauche.png" alt="" /><img style="width:5px; height:1px;" src="images/trans.gif" alt="" /><span class="texta11 gras gris3">'+trlg("D535","ne pas quitter")+'</span>';
	
	//var str = '<div><div id="modconfirmMessage">'+text+'</div><div class="modconfirm_buttons"><span class="modconfirm_no" OnClick="modconfirm2_masque();">NON</span><span class="modconfirm_yes" OnClick="modconfirm2_backexe();">OUI</span></div></div>';
	var str = '<div class="texte_centre"><div id="modconfirmMessage">'+text+'</div><div class="modconfirm_buttons"><span class="modconfirm_no cliquable" onclick="$(\'#bloc_flottant\').dialog(\'close\');">'+annuler+'</span><span class="modconfirm_yes" OnClick="modconfirm2_backexe();">'+quitter+'</span></div></div>';
	masque_selects_ie6();
	$("#bloc_flottant").html(inject_wait(2, 50));
	$("#bloc_flottant").html(str);
	/*document.getElementById('modconfirmCont').innerHTML=str;
	$("#modconfirmCont").css("top", (document.documentElement.scrollTop + 100));
	document.getElementById('modconfirm2Back').style.display='block';
	document.getElementById('modconfirmCont').style.display='block';*/
	
	$("#bloc_flottant").dialog({
	 	resizable: false, 
		draggable: false,
		dialogClass: "dialog_standard", 
		modal: true,
		close: function(){raffiche_selects_ie6();},
		width: 450,
		height: 150,
		overlay: { opacity: 0.1, background: "#fff" }		
	});	 
	$('.ui-dialog-container').corner({
		tl:{radius:5},
		tr:{radius:5},
		bl:{radius:5},
		br:{radius:5},
		antiAlias:true,
		autoPad:false}
	);
	$(".ui-dialog-titlebar-close").blur();	
}
function modconfirm2_masque() {
	document.getElementById('modconfirmCont').style.display='none';
	document.getElementById('modconfirm2Back').style.display='none';
	$('#bloc_flottant').dialog('close');
	if (document.getElementById('modconfirmMessage')) {
		document.getElementById('modconfirmMessage').innerHTML='';
	}
}
function modconfirm2_backexe() {
	modconfirm2_masque();
	if (modconfirm_back){
		var els = modconfirm_back.split("::");
		var els_type = els[0];
		var els_val = els[1];
		if (els_type == 'u'){
			document.location.href=els_val;
		} else {
			eval(els_val);
			mec=0;
		}
	}
}


var mec = 0;
var mec2 = 0;
var mess_modif='';
var mess_modif2='';
function modif_en_cours(v)
{
	mec=v;
}	
function modif_en_cours2(v)
{
	mec2=v;
}	

function demande(p)
{
	if (mec==1)
	{
		if (p){
			modconfirm2(p);
			mec=0;
			return false;
		} else {
			if (mess_modif=='') mess_modif=trlg("F97","Poursuivre sans sauvegarder les modifications effectuées");
			if	(confirm(mess_modif))
			{
				mess_modif='';
				mec=0;
				return true;
			}	
			else
			{
				mess_modif='';
				return false;
			}
		}
	}
	else
	{
		if (p){
			modconfirm_back = p;
			modconfirm2_backexe();
			return false;
		} else {
			mess_modif='';
			return true;
		}
	}
}

function demande2(execut)
{
	if (mec2==1)
	{
		modconfirm2m();
		mec2=0;
		return false;
	}
	else
	{
		$.modal.close();
		if (execut){
			eval(execut);
		}
		mess_modif2='';
		return true;
	}
}

function modconfirm2m() {
	//var text = trlg("F97","Poursuivre sans sauvegarder les modifications effectuées");
	var text = '<div class="texta12 gras gris4" style="margin-top:10px;">'+trlg("D532","Souhaitez-vous quitter cette page")+' ?</div>';
	text += '<div class="texta11 gris4" style="margin-top:15px;">'+trlg("D533","Les informations données, les modifications effectuées ne seront pas prises en compte")+'.</div>';
	var quitter = '<img class="png_trans" src="images/triangle_grisfonce_droit.png" alt="" /> <span class="texta11 gras gris4">'+trlg("D534","quitter")+'</span>';
	var annuler = '<img class="png_trans" src="images/triangle_gris_gauche.png" alt="" /><img style="width:5px; height:1px;" src="images/trans.gif" alt="" /><span class="texta11 gras gris3">'+trlg("D535","ne pas quitter")+'</span>';
	
	//var str = '<div><div id="modconfirmMessage">'+text+'</div><div class="modconfirm_buttons"><span class="modconfirm_no" OnClick="modconfirm_masque();">NON</span><span class="modalClose modconfirm_yes" OnClick="modconfirm_masque();$.modal.close();">OUI</span></div></div>';
	var str = '<div><div id="modconfirmMessage">'+text+'</div><div class="modconfirm_buttons"><span class="modalClose modconfirm_no">'+annuler+'</span><span class="modalClose modconfirm_yes" OnClick="modconfirm_backexe();$.modal.close();">'+quitter+'</span></div></div>';
	
	document.getElementById('modconfirmCont').innerHTML=str;
	$("#modconfirmCont").css("top", (document.documentElement.scrollTop + 100));
	document.getElementById('modconfirmBack').style.display='block';
	document.getElementById('modconfirmCont').style.display='block';
}





function autoefface_focus_login_pseudo() {
	if (document.getElementById('login_pseudo_autoefface').value == 1) {
		document.getElementById('login_pseudo').value = '';		
	}
	if (document.getElementById('retour_erreur_login').style.display== "block"){
		document.getElementById('retour_erreur_login').style.display="none";
	}	
}

function autoefface_unfocus_login_pseudo() {
	var texte = trlg('C607', 'login');
	if (document.getElementById('login_pseudo_autoefface').value == 1) {
		if (document.getElementById('login_pseudo').value == '') {
		} else {
			document.getElementById('login_pseudo_autoefface').value = 2;
		}
	}
	if (document.getElementById('login_pseudo_autoefface').value == 2) {
		if (document.getElementById('login_pseudo').value == '') {
			document.getElementById('login_pseudo_autoefface').value = 1;
		} else {
		}
	}
	if (document.getElementById('login_pseudo_autoefface').value == 1) {
		
		document.getElementById('login_pseudo').value = texte;
	}

}

function autoefface_focus_login_password() {
	if (document.getElementById('login_password_autoefface').value == 1) {
		document.getElementById('login_password').value = '';		
	}
	if (document.getElementById('retour_erreur_login').style.display== "block"){
		document.getElementById('retour_erreur_login').style.display="none";
	}		
}

function autoefface_unfocus_login_password() {
	var texte = trlg('S4', 'mot de passe');
	if (document.getElementById('login_password_autoefface').value == 1) {
		if (document.getElementById('login_password').value == '') {
		} else {
			document.getElementById('login_password_autoefface').value = 2;
		}
	}
	if (document.getElementById('login_password_autoefface').value == 2) {
		if (document.getElementById('login_password').value == '') {
			document.getElementById('login_password_autoefface').value = 1;
		} else {
		}
	}
	if (document.getElementById('login_password_autoefface').value == 1) {
		
		document.getElementById('login_password').value = texte;
	}

}


function trlg(code, texte) {
	if (typeof(vtrlg)!='undefined'){
		if (!vtrlg[code]) {
                        $.post("ajax/trlg.php", { code: code, texte: texte } );
			return texte;
		} else {
			return vtrlg[code];
		}
	} else {
		$.post("ajax/trlg.php", { code: code, texte: texte } );
		return texte;
	}
}




function chklogpsw() {
	masque('bouton_connect');
	affiche('bouton_connect_wait');
	var l = document.getElementById('login_pseudo').value;
	var p = document.getElementById('login_password').value;
	if (document.getElementById('garderlogin').checked) {
		var g = 1;
	} else {
		var g = 0;
	}
	$.post("ajax/chklogpsw.php", { l: l, p: p, g: g },
		function(data){
			var erreur=data;
 			if (erreur.substring(0,1)=="_") {
				var str = erreur.substring(1,(erreur.length));
				var expDate = new Date()
				expDate.setTime(expDate.getTime() + (365 * 24 * 3600 * 1000))
				var cstr = "";
				cstr = cstr+"garderlogin="+escape(str);
				cstr = cstr+";expires="+expDate.toGMTString();
				document.cookie=cstr;
				document.location.href="index.php";
			} else {
				$("#retour_erreur_login").css({
						display: "block"
				});
				$("#retour_erreur_login").html("<div class='txt_erreur_login'>"+erreur+"</div>"); 
				masque('bouton_connect_wait');
				affiche('bouton_connect');
			} 
	});
}


// fenetres...
var modconfirm_back = '';


function modconfirm(text, callback, txtoui, txtnon) {
	modconfirm_back = callback;
	if (!txtoui) {
		txtoui = trlg("S134", "OUI");
	}
	if (!txtnon) {
		txtnon = trlg("S135", "NON");
	}
	//var str = '<div><div id="modconfirmMessage">'+text+'</div><div class="modconfirm_buttons"><span class="modconfirm_no" OnClick="modconfirm_masque();">'+txtnon+'</span><span class="modconfirm_yes" OnClick="modconfirm_backexe();">'+txtoui+'</span></div></div>';
	var str = '<div id="modconfirmMessage" class="texte_centre" style="margin-top:-5px;padding-left:10px;padding-right:10px;padding-top:20px;color:#333333;"><div style="padding-left:5px;padding-right:5px;">'+text+'</div><div class="modconfirm_buttons"><span class="modconfirm_no cliquable" onclick="$(\'#bloc_flottant\').dialog(\'close\');">'+txtnon+'</span><span class="modconfirm_yes" onclick="modconfirm_backexe();" id="modconfirmMessage_w">'+txtoui+'</span></div></div>';
	
	masque_selects_ie6();
	
	$("#bloc_flottant").html(inject_wait(2, 50));
	$("#bloc_flottant").html(str);
	
	$("#bloc_flottant").dialog({
	 	resizable: false, 
		draggable: false,
		dialogClass: "dialog_standard", 
		modal: true,
		close: function(){raffiche_selects_ie6();},
		width: 450,
		height: 200,
		overlay: { opacity: 0.1, background: "#fff" }		
	});	 
	$('.ui-dialog-container').corner({
		tl:{radius:5},
		tr:{radius:5},
		bl:{radius:5},
		br:{radius:5},
		antiAlias:true,
		autoPad:false}
	);
	$(".ui-dialog-titlebar-close").blur();	
	
	/*document.getElementById('modconfirmCont').innerHTML=str;
	$("#modconfirmCont").css("top", (document.documentElement.scrollTop + 100));
	document.getElementById('modconfirmBack').style.display='block';
	document.getElementById('modconfirmCont').style.display='block';*/
}
function modconfirm_masque() {
	document.getElementById('modconfirmCont').style.display='none';
	document.getElementById('modconfirmBack').style.display='none';
	document.getElementById('modconfirmMessage').innerHTML='';
	$('#bloc_flottant').dialog('close');
}
function modconfirm_backexe() {
	document.getElementById("modconfirmMessage_w").style.visibility='hidden';
	//document.getElementById("modconfirmMessage_w").innerHTML='<img src="images/wait1.gif">';
	//document.getElementById("modconfirmMessage_w").style.visibility='visible';
	modconfirm_masque();
	if (modconfirm_back){
		eval(modconfirm_back);
	}
}

function suite() {
	alert('ok');
}

function retour_inscription(id){
	if(id=="inscription"){
		if(document.getElementById("confirmation")){
			document.getElementById("confirmation").style.display="block";
		}
	}
}

function modalClic(id, opt) {
	var contid = 'ModalContainer_'+id;

	var open = "modalOpen";
	var close = "modalClose";
	var plus = "";
	if (typeof(opt)=="string"){
		var opt_arr = opt.split("#");
		for (var i=0; i<opt_arr.length; i++) {
			var strdec = opt_arr[i].split("::");
			if (strdec[0]=="open"){
				open = strdec[1];
			}
			if (strdec[0]=="close"){
				close = strdec[1];
			}
			if (strdec[0]=="plus"){
				plus = ","+strdec[1];
			}
		}
	}
	var str = "$('#'+id).modal({onOpen:"+open+",onClose:"+close+",containerId:contid,close:false"+plus+"});";
	eval(str);
	
	setTimeout("retour_inscription('"+id+"')",1000);
}
function modalOpen (dialog) {
	dialog.overlay.fadeIn('fast', function () {
		dialog.container.show('fast', function () {
			dialog.data.fadeIn('fast');
		});
	});
}
function modalClose(dialog) {
	modalCloseConfirm(dialog);
}
function modalCloseConfirm (dialog) {
	dialog.data.fadeOut('fast', function () {
		dialog.container.hide('fast', function () {
			dialog.overlay.fadeOut('fast', function () {
				$.modal.close();
			});
		});
	});
}





function affiche_profil(idi, mode, zone, js_open, js_close, trajet) {

	if(zone == "bonsplans" || zone == "bonplanhome" || zone == "messagerie"){
		document.getElementById("profil_inj").style.marginLeft = "28px";
	}else if(zone == "communaute"){
		document.getElementById("profil_inj").style.marginLeft = "15px";
		document.getElementById("profil_inj").style.marginRight = "2px";
	}else{
		document.getElementById("profil_inj").style.marginLeft = "15px";
	}

	if (js_open){
		eval(js_open);
	}
	var waiting = affiche_profil_wait();
	$("#profil_inj").html(waiting);
	
	$("#profil_inj").css({ display:"block"});

	$.get("ajax/pr_aff.php", { id: idi, m: mode, z: zone, r: js_close, trajet: trajet },
		function(data){
			$("#profil_inj").html(data);
			affiche_profil_changemode(mode);
		}
	);

}
function affiche_profil_wait() {
	var str = '';
	str = '<div id="pr_inj_wait"><img src="images/wait2.gif"></div>';
	return str;
}
function masque_profil(js_close) {
	galpr_ouvert = 0;
 	$("#profil_inj").fadeOut("normal", function () {
        if (js_close){
			eval(js_close);
		}
      });
}

function masque_profil_retour(js_close) {
	galpr_ouvert = 0;
	  $("#profil_inj").css({ display:"none"});
		if (js_close){
			eval(js_close);
		} 
}

function cacher_profil(idi){
	if(document.getElementById("bloc_fermeture_"+idi).style.display == "block"){
		$("#bloc_fermeture_"+idi).fadeOut("fast");			
	}
	if(document.getElementById("pr_inj_profil_lien_fermer_"+idi+"_1")){ 
		document.getElementById("pr_inj_profil_lien_fermer_"+idi+"_1").style.display = "none";
		document.getElementById("pr_inj_profil_lien_voir_"+idi+"_1").style.display = "block";
	}
	if(document.getElementById("pr_inj_profil_lien_fermer_"+idi+"_2")){ 
		document.getElementById("pr_inj_profil_lien_fermer_"+idi+"_2").style.display = "none";
		document.getElementById("pr_inj_profil_lien_voir_"+idi+"_2").style.display = "block";
	}
	if(document.getElementById("pr_inj_profil_lien_fermer_"+idi+"_3")){ 
		document.getElementById("pr_inj_profil_lien_fermer_"+idi+"_3").style.display = "none";
		document.getElementById("pr_inj_profil_lien_voir_"+idi+"_3").style.display = "block";
	}	
}

function affiche_profil_changemode(mode) {
	var obj;
	var sel = "";

	if(mode == "a"){
		var i = 0;		
		while(i <= 3){
			if(document.getElementById("pr_inj_profil_lien_voir_a_"+i)){ document.getElementById("pr_inj_profil_lien_voir_a_"+i).style.display = "none"; }
			if(document.getElementById("pr_inj_profil_lien_fermer_a_"+i)){ document.getElementById("pr_inj_profil_lien_fermer_a_"+i).style.display = "block";	 }
			if(document.getElementById("pr_inj_profil_lien_voir_l_"+i)){ document.getElementById("pr_inj_profil_lien_voir_l_"+i).style.display = "block"; }
			if(document.getElementById("pr_inj_profil_lien_fermer_l_"+i)){ document.getElementById("pr_inj_profil_lien_fermer_l_"+i).style.display = "none"; }	
			if(document.getElementById("pr_inj_profil_lien_voir_v_"+i)){ document.getElementById("pr_inj_profil_lien_voir_v_"+i).style.display = "block"; }
			if(document.getElementById("pr_inj_profil_lien_fermer_v_"+i)){ document.getElementById("pr_inj_profil_lien_fermer_v_"+i).style.display = "none"; }	
			i++;
		}		
	}else if(mode == "l"){
		var i = 0;		
		while(i <= 3){
			if(document.getElementById("pr_inj_profil_lien_voir_l_"+i)){ document.getElementById("pr_inj_profil_lien_voir_l_"+i).style.display = "none"; }
			if(document.getElementById("pr_inj_profil_lien_fermer_l_"+i)){ document.getElementById("pr_inj_profil_lien_fermer_l_"+i).style.display = "block"; }			
			if(document.getElementById("pr_inj_profil_lien_voir_a_"+i)){ document.getElementById("pr_inj_profil_lien_voir_a_"+i).style.display = "block"; }
			if(document.getElementById("pr_inj_profil_lien_fermer_a_"+i)){ document.getElementById("pr_inj_profil_lien_fermer_a_"+i).style.display = "none"; }		
			if(document.getElementById("pr_inj_profil_lien_voir_v_"+i)){ document.getElementById("pr_inj_profil_lien_voir_v_"+i).style.display = "block"; }
			if(document.getElementById("pr_inj_profil_lien_fermer_v_"+i)){ document.getElementById("pr_inj_profil_lien_fermer_v_"+i).style.display = "none"; }	
			i++;
		}		
	}else if(mode == "v"){
		var i = 0;		
		while(i <= 3){
			if(document.getElementById("pr_inj_profil_lien_voir_v_"+i)){ document.getElementById("pr_inj_profil_lien_voir_v_"+i).style.display = "none"; }
			if(document.getElementById("pr_inj_profil_lien_fermer_v_"+i)){ document.getElementById("pr_inj_profil_lien_fermer_v_"+i).style.display = "block"; }			
			if(document.getElementById("pr_inj_profil_lien_voir_l_"+i)){ document.getElementById("pr_inj_profil_lien_voir_l_"+i).style.display = "block"; }
			if(document.getElementById("pr_inj_profil_lien_fermer_l_"+i)){ document.getElementById("pr_inj_profil_lien_fermer_l_"+i).style.display = "none"; }			
			if(document.getElementById("pr_inj_profil_lien_voir_a_"+i)){ document.getElementById("pr_inj_profil_lien_voir_a_"+i).style.display = "block"; }
			if(document.getElementById("pr_inj_profil_lien_fermer_a_"+i)){ document.getElementById("pr_inj_profil_lien_fermer_a_"+i).style.display = "none"; }		
			i++;
		}	
	}
	
	if(document.getElementById("bloc_fermeture_"+mode)){ document.getElementById("bloc_fermeture_"+mode).style.display = "block"; }	

	if(document.getElementById('pr_inj_profil_v')){ 
		obj = document.getElementById('pr_inj_profil_v'); 
		if (obj.style.display=='block'){
			sel = "v";
		}
	}	
	if(document.getElementById('pr_inj_profil_l')){ 
		obj = document.getElementById('pr_inj_profil_l'); 
		if (obj){
			if (obj.style.display=='block'){
				sel = "l";
			}
		}
	}	
	if(document.getElementById('pr_inj_profil_a')){ 
		obj = document.getElementById('pr_inj_profil_a'); 
		if (obj){
			if (obj.style.display=='block'){
				sel = "a";
			}
		}
	}	

	if (sel){
		$("#pr_inj_profil_"+sel).fadeOut("fast", function () {
			$("#pr_inj_profil_"+mode).fadeIn("fast");
			if (mode=="v"){
				$("#pr_inj_bas").fadeIn("fast");
			}
		});
		if (sel=="v"){
			$("#pr_inj_bas").fadeOut("fast");
		}
	} else {
		affiche("pr_inj_profil_"+mode);
		if (mode=="v"){
			affiche("pr_inj_bas");
		}
	}
}

function affiche_profil_bp_pays(idi, idp) {
	$.get("ajax/pr_aff_bp.php", { i: idi, p: idp },
		function(data){
			obj = document.getElementById('pr_inj_bp');
			if (obj.style.display=='block'){
				$("#pr_inj_bp").fadeOut("normal", function () {
					$("#pr_inj_bp_data").html(data);
				});
			} else {
				$("#pr_inj_bp_data").html(data);
			}
			if (data){
				$("#pr_inj_bp").fadeIn("normal");
			}
		}
	);

}

//messagerie profil
function verif_mess_profil(id_i, id_d, mess, origine)
{
	var mess_erreur = trlg("D96","Merci de saisir votre message.");
	var res = 1;
	var url = 'ajax/me_envoi_mess.php?id_i='+id_i+'&id_d='+id_d+'&m='+mess;

	// Test si le message est vide
	if(mess == '')
	{
		document.getElementById('erreur_message').innerHTML = mess_erreur;
		res = res * 0;
	}

	// Si le message est valide, on l'envoie
	if (res == 1)
	{
		$.post(
			"ajax/me_envoi_mess.php",
			{ id_d: id_d, m: mess, origine: origine },
			function(data){
				var vecteur = data.split('##');
				var id_dest = vecteur[0];
				var res = vecteur[1];
				var text = '<div class="texte_centre gras texta12" style="padding-top:30px;">'+trlg("C194","Votre message a bien été envoyé")+'</div>'; 
				document.getElementById('bloc_mess_profil').innerHTML = text;
				setTimeout("if(fermer_av == 0){$('#bloc_flottant').dialog('close');}",5000);
			}
		);
	}
}

//PopIn FAQs
function affiche_faq() {
	action_ouverture_popin();
	$("#bloc_faq").html(inject_wait(2, 50));
	$.post("ajax/faq.php", {},
		function(data){ $("#bloc_faq").html('<div style="padding-top:15px;">'+data+'</div>'); }
	); 
	$("#bloc_faq").dialog({ 
		dialogClass: "popin_bug", 
		position: "right",		
		close: function(){ raffiche_selects_ie6();},
		resizable: false,
		draggable: true,		
		width: 610,
		height: 500,
		modal: false	
	});	 
	$('.ui-dialog-container').corner({
		tl:{radius:5},
		tr:{radius:5},
		bl:{radius:5},
		br:{radius:5},
		antiAlias:true,
		autoPad:false}
	);		
	$(".ui-dialog-titlebar-close").blur();
} 


//PopIn suggestion & bug
function affiche_bug() {
	action_ouverture_popin();
	$("#bloc_bug").html(inject_wait(2, 50));
	$.post("ajax/bug.php", {},
		function(data){ $("#bloc_bug").html('<div style="padding-top:15px;">'+data+'</div>'); }
	); 
	$("#bloc_bug").dialog({ 
		dialogClass: "popin_bug",
		position: "right",
		draggable: false,
		close: function(){ 
			fermer_av = 1;
			raffiche_selects_ie6();
		},
		resizable: false, 		
		width: 500,
		height: 300,
		modal: false	
	});	 	
	$('.ui-dialog-container').corner({
		tl:{radius:5},
		tr:{radius:5},
		bl:{radius:5},
		br:{radius:5},
		antiAlias:true,
		autoPad:false}
	);		
	$(".popin_bug").draggable({containment: "#divbody"});
	$(".ui-dialog-titlebar-close").blur();	
} 
function action_form_bug(id_inscrit,email,nom){
	fermer_av = 0;
 	var url = document.location.href;
	var message = document.getElementById("contact_message_bug").value;	
	if(document.getElementById("suggestion").checked==true)	email_destinataire = 'suggestion';
	if(document.getElementById("probleme").checked==true) email_destinataire = 'bug';
	$.post("ajax/bug.php", { email_destinataire: email_destinataire, url: url, message: message, id_inscrit : id_inscrit, email: email, nom: nom },
		function(data){
			$("#bloc_bug").html(data);
			$(".ui-dialog-container").css({ width: 500, height: 150 });	
			$(".ui-dialog-content").css({ width: 490, height: 122 });	
			setTimeout("if(fermer_av == 0){$('#bloc_bug').dialog('close');}",7000);
		}
	); 	 	
}
function action_form_bug_non_log(){
	fermer_av = 0;
 	var url = document.location.href;
	var message = document.getElementById("contact_message_bug").value;	
	if(document.getElementById("suggestion").checked==true)	email_destinataire = 'suggestion';
	if(document.getElementById("probleme").checked==true) email_destinataire = 'bug';
	$.post("ajax/bug.php", {email_destinataire: email_destinataire, url: url, message: message},
		function(data){
			$("#bloc_bug").html(data);
			$(".ui-dialog-container").css({ width: 500, height: 150 });	
			$(".ui-dialog-content").css({ width: 490, height: 122 });
			setTimeout("if(fermer_av == 0){$('#bloc_bug').dialog('close');}",7000);		
		}
	); 	 
}


//formulaire de réponse au support client
function ouvre_contact_rp_mc(id_mc,id_inscrit_mc) {
	masque_selects_ie6();
	$("#bloc_flottant").html(inject_wait(2, 10));
	$.post("ajax/contact_rp.php", {id_mc: id_mc, id_inscrit_mc: id_inscrit_mc},
		function(data){ 
			$("#bloc_flottant").html(data); 
		}
	);	
	$("#bloc_flottant").dialog({ 
		dialogClass: "formulaire_contact",
		resizable: false, 
		draggable: false,
		close: function(){
			fermer_av = 1;
			raffiche_selects_ie6();
		},	    
		width: 675,
		height: 550,
		modal: true,  
	    overlay: { opacity: 0.75, background: "#000000" }
	});	
	$(".ui-dialog-titlebar-close").blur();	
}
function action_form_contact_rp(){
	fermer_av = 0;	
	document.getElementById("btn_contact_fixe").style.display = 'none';
	document.getElementById("btn_contact_load_rp").innerHTML = '<img src="images/wait2.gif" />';		
	var url_rp = document.location.href;
	var id_rp = document.getElementById("id_mc").value;	
	var id_inscrit_rp = document.getElementById("id_inscrit_mc").value;		
	var message_rp = document.getElementById("contact-message").value;	
	var nom_rp = document.getElementById("nom_mc").value;			
	var prenom_rp = document.getElementById("prenom_mc").value;		
	var email_rp = document.getElementById("email_mc").value;
 	$.post("ajax/contact_rp.php", {url_rp: url_rp, message_rp: message_rp, nom_rp: nom_rp, prenom_rp: prenom_rp, email_rp: email_rp, id_rp: id_rp, id_inscrit_rp: id_inscrit_rp},
		function(data){
			$.scrollTo("#scroll_contact", {duration:800}, {top:'+=100px'} );
			$("#bloc_flottant").html(data);
			$(".ui-dialog-container").css({ width: 675, height: 200 });	
			$(".ui-dialog-content").css({ width: 675, height: 200 });
			setTimeout("if(fermer_av == 0){$('#bloc_flottant').dialog('close');}",8000);			
		}
	);			 
}

//PopIn formulaire de contact v2
function affiche_form_contact() {
	masque_selects_ie6();
	$("#bloc_flottant").html(inject_wait(2, 50));
	$.post("ajax/contact.php", {},
		function(data){ $("#bloc_flottant").html(data); }
	);	
	$("#bloc_flottant").dialog({ 
		dialogClass: "formulaire_contact",
		resizable: false, 
		draggable: false,
		close: function(){
			fermer_av = 1;
			raffiche_selects_ie6();
		},	     
		width: 675,
		height: 550,
		modal: true, 
	    overlay: { opacity: 0.75, background: "#000000" }
	});	
	$(".ui-dialog-titlebar-close").blur();	
}

function affiche_form_contact_non_log() {
	masque_selects_ie6();
	$("#bloc_flottant").html(inject_wait(2, 10));
	$.post("ajax/contact.php", {},
		function(data){ $("#bloc_flottant").html(data); }
	);	
	$("#bloc_flottant").dialog({ 
		dialogClass: "formulaire_contact",
		resizable: false, 
		draggable: false,
		close: function(){
			fermer_av = 1;
			raffiche_selects_ie6();
		},	    
		width: 675,
		height: 550,
		modal: true,  
	    overlay: { opacity: 0.75, background: "#000000" }
	});	
	$(".ui-dialog-titlebar-close").blur();	
}

function test_email_destinataire(){
	if(document.getElementById("demande").value=="annonceur")	email_destinataire = 'annonceur';
	else if(document.getElementById("demande").value=="partenaire") email_destinataire = 'partenaire';
	else email_destinataire = 'visiteur'; 
	return email_destinataire;
}	
function action_form_contact_non_log(objet){
	fermer_av = 0;	
	document.getElementById("btn_contact_fixe").style.display = 'none';
	document.getElementById("btn_contact_load").innerHTML = '<img src="images/wait2.gif" />';		
	var url = document.location.href;
	var message = document.getElementById("contact-message").value;	
	var email_destinataire = document.getElementById("demande").value
	var nom = document.getElementById("nom_test").value;			
	var email = document.getElementById("email_test").value;		
	if(document.getElementById("prenom_test")) { var prenom = document.getElementById("prenom_test").value; } else{ var prenom = trlg("C302", "non renseigné"); }
	if(document.getElementById("tel_test")) { var tel = document.getElementById("tel_test").value; } else{ var tel = trlg("C302", "non renseigné"); }	
	if((document.getElementById("demande").value=="partenaire") || (document.getElementById("demande").value=="annonceur")){	
		if(document.getElementById("demande").value=="partenaire"){ objet = "partenaire"; }
		if(document.getElementById("demande").value=="annonceur"){ objet = "annonceur"; }
		$.post("ajax/contact_annonceur.php", {email_destinataire: email_destinataire, url: url, message: message, nom: nom, prenom: prenom, email: email, tel: tel, objet: objet},
			function(data){
				$.scrollTo("#scroll_contact", {duration:800}, {top:'+=100px'} );	
				$("#bloc_flottant").html(data);
				$(".ui-dialog-container").css({ width: 675, height: 200 });	
				$(".ui-dialog-content").css({ width: 675, height: 200 });	
				setTimeout("if(fermer_av == 0){$('#bloc_flottant').dialog('close');}",8000);
			}
		); 			
	} else {
		$.post("ajax/contact_visiteur.php", {email_destinataire: email_destinataire, url: url, message: message, nom: nom, prenom: prenom, email: email, tel: tel, objet: objet},
			function(data){
				$.scrollTo("#scroll_contact", {duration:800}, {top:'+=100px'} );
				$("#bloc_flottant").html(data);
				$(".ui-dialog-container").css({ width: 675, height: 200 });	
				$(".ui-dialog-content").css({ width: 675, height: 200 });
				setTimeout("if(fermer_av == 0){$('#bloc_flottant').dialog('close');}",8000);			
			}
		); 		
	}		 
}
function action_form_contact_logue(id_inscrit,email,nom,demande){
	fermer_av = 0;		
	document.getElementById("btn_contact_fixe").style.display = 'none';
	document.getElementById("btn_contact_load").innerHTML = '<img src="images/wait2.gif" />';	
 	var url = document.location.href;
	var message = document.getElementById("contact-message").value;	
	var objet = demande;	
	if(demande == "partenaire") var email_destinataire = "partenaire";
	else if(demande == "annonceur") var email_destinataire = "annonceur";
	else var email_destinataire = "visiteur";	
	if(document.getElementById("tel_test")) { var tel = document.getElementById("tel_test").value; } else{ var tel = trlg("C302", "non renseigné"); }	
	if((demande == "annonceur") || (demande == "partenaire")){	
		$.post("ajax/contact_annonceur.php", {email_destinataire: email_destinataire, url: url, message: message, nom: nom, email: email, tel: tel, objet: objet},
			function(data){
				$.scrollTo("#scroll_contact", {duration:800}, {top:'+=100px'} );
				$("#bloc_flottant").html(data);
				$(".ui-dialog-container").css({ width: 675, height: 200 });		
				$(".ui-dialog-content").css({ width: 675, height: 200 });
				setTimeout("if(fermer_av == 0){$('#bloc_flottant').dialog('close');}",8000);
			}
		); 			
	} else {
		$.post("ajax/contact_visiteur.php", {email_destinataire: email_destinataire, url: url, message: message, nom: nom, email: email, tel: tel, objet: objet},
			function(data){
				$.scrollTo("#scroll_contact", {duration:800}, {top:'+=100px'} );
				$("#bloc_flottant").html(data);
				$(".ui-dialog-container").css({ width: 675, height: 200 });		
				$(".ui-dialog-content").css({ width: 675, height: 200 });
				setTimeout("if(fermer_av == 0){$('#bloc_flottant').dialog('close');}",8000);
			}
		); 		
	}
}

function action_form_contact(id_inscrit,email,nom,objet){
	fermer_av = 0;	
	document.getElementById("btn_contact_fixe").style.display = 'none';
	document.getElementById("btn_contact_load").innerHTML = '<img src="images/wait2.gif" />';		
 	var url = document.location.href;
	var message = document.getElementById("contact-message").value;	
	var email_destinataire = test_email_destinataire();	
	if(document.getElementById("tel_test")) { var tel = document.getElementById("tel_test").value; } else{ var tel = trlg("C302", "non renseigné"); }	
	if((document.getElementById("demande").value=="partenaire") || (document.getElementById("demande").value=="annonceur")){	
		$.post("ajax/contact_annonceur.php", {email_destinataire: email_destinataire, url: url, message: message, nom: nom, email: email, tel: tel, objet: objet},
			function(data){
				$.scrollTo("#scroll_contact", {duration:800}, {top:'+=100px'} );
				$("#bloc_flottant").html(data);
				$(".ui-dialog-container").css({ width: 675, height: 200 });	
				$(".ui-dialog-content").css({ width: 675, height: 200 });	
				setTimeout("if(fermer_av == 0){$('#bloc_flottant').dialog('close');}",8000);			
			}
		); 			
	} else {
		$.post("ajax/contact_visiteur.php", {email_destinataire: email_destinataire, url: url, message: message, nom: nom, email: email, tel: tel, objet: objet},
			function(data){
				$.scrollTo("#scroll_contact", {duration:800}, {top:'+=100px'} );
				$("#bloc_flottant").html(data);
				$(".ui-dialog-container").css({ width: 675, height: 200 });		
				$(".ui-dialog-content").css({ width: 675, height: 200 });	
				setTimeout("if(fermer_av == 0){$('#bloc_flottant').dialog('close');}",8000);
			}
		); 		
	}	 
}
/*
function affiche_form_contact() {
	masque_selects_ie6();
	$("#bloc_flottant").html(inject_wait(2, 50));
	$.post("ajax/contact.php", {},
		function(data){ $("#bloc_flottant").html(data); }
	);	
	$("#bloc_flottant").dialog({ 
		dialogClass: "formulaire_contact",
		resizable: false, 
		draggable: false,
		close: function(){
			fermer_av = 1;
			raffiche_selects_ie6();
		},	     
		width: 675,
		height: 550,
		modal: true, 
	    overlay: { opacity: 0.75, background: "#000000" }
	});	
	$(".ui-dialog-titlebar-close").blur();	
}

function affiche_form_contact_non_log() {
	masque_selects_ie6();
	$("#bloc_flottant").html(inject_wait(2, 10));
	$.post("ajax/contact.php", {},
		function(data){ $("#bloc_flottant").html(data); }
	);	
	$("#bloc_flottant").dialog({ 
		dialogClass: "formulaire_contact",
		resizable: false, 
		draggable: false,
		close: function(){
			fermer_av = 1;
			raffiche_selects_ie6();
		},	    
		width: 675,
		height: 220,
		modal: true,  
	    overlay: { opacity: 0.75, background: "#000000" }
	});	
	$(".ui-dialog-titlebar-close").blur();	
}
function choix_type_demandeur(type_demandeur){
	if(type_demandeur == "partenaire" || type_demandeur == "annonceur"){ 
		$.post("ajax/contact_annonceur.php", {},
			function(data){
				$(".ui-dialog").css({ width: 675, height: 550 });
				$("#bloc_flottant").html(data);
				document.getElementById(type_demandeur).checked=true;
				$.scrollTo("#scroll_contact", 800 );	
				$(".ui-dialog-overlay").css({height: taille });		
				if (document.body){
					var taille = (document.body.clientHeight);
				}else{
					var taille = (window.innerHeight);
				}	
				new_taille = taille+200;
				$(".ui-dialog-overlay").css({height: new_taille });					
			}
		);	
	} else {	
		$.post("ajax/contact_visiteur.php", {},
			function(data){
				$(".ui-dialog").css({ width: 675, height: 550 });		
				$("#bloc_flottant").html(data);
				document.getElementById("visiteur").checked=true;
				$.scrollTo("#scroll_contact", 800 );						
				if (document.body){
					var taille = (document.body.clientHeight);
				}else{
					var taille = (window.innerHeight);
				}	
				new_taille = taille+200;
				$(".ui-dialog-overlay").css({height: new_taille });	
			}
		);	
	}	
}
function test_email_destinataire(){
	if(document.getElementById("annonceur").checked==true)	email_destinataire = 'annonceur';
	else if(document.getElementById("partenaire").checked==true) email_destinataire = 'partenaire';
	else email_destinataire = 'visiteur';
	return email_destinataire;
}	
function action_form_contact_non_log(objet){
	fermer_av = 0;
	
	document.getElementById("btn_contact_fixe").style.display = 'none';
	document.getElementById("btn_contact_load").innerHTML = '<img src="images/wait2.gif" />';
		
	var url = document.location.href;
	var message = document.getElementById("contact-message").value;	
	var email_destinataire = test_email_destinataire();
	var nom = document.getElementById("nom_test").value;			
	var email = document.getElementById("email_test").value;		
	if(document.getElementById("prenom_test")) { var prenom = document.getElementById("prenom_test").value; } else{ var prenom = trlg("C302", "non renseigné"); }
	if(document.getElementById("tel_test")) { var tel = document.getElementById("tel_test").value; } else{ var tel = trlg("C302", "non renseigné"); }	
	if((document.getElementById("partenaire").checked==true) || (document.getElementById("annonceur").checked==true)){	
		if(document.getElementById("partenaire").checked==true){ objet = "partenaire"; }
		if(document.getElementById("annonceur").checked==true){ objet = "annonceur"; }
		$.post("ajax/contact_annonceur.php", {email_destinataire: email_destinataire, url: url, message: message, nom: nom, prenom: prenom, email: email, tel: tel, objet: objet},
			function(data){
				$.scrollTo("#scroll_contact", {duration:800}, {top:'+=100px'} );	
				$("#bloc_flottant").html(data);
				$(".ui-dialog-container").css({ width: 675, height: 200 });	
				$(".ui-dialog-content").css({ width: 675, height: 200 });	
				setTimeout("if(fermer_av == 0){$('#bloc_flottant').dialog('close');}",8000);
			}
		); 			
	} else {
		$.post("ajax/contact_visiteur.php", {email_destinataire: email_destinataire, url: url, message: message, nom: nom, prenom: prenom, email: email, tel: tel, objet: objet},
			function(data){
				$.scrollTo("#scroll_contact", {duration:800}, {top:'+=100px'} );
				$("#bloc_flottant").html(data);
				$(".ui-dialog-container").css({ width: 675, height: 200 });	
				$(".ui-dialog-content").css({ width: 675, height: 200 });
				setTimeout("if(fermer_av == 0){$('#bloc_flottant').dialog('close');}",8000);			
			}
		); 		
	}		 
}
function action_form_contact_logue(id_inscrit,email,nom,demande){
	fermer_av = 0;	
	
	document.getElementById("btn_contact_fixe").style.display = 'none';
	document.getElementById("btn_contact_load").innerHTML = '<img src="images/wait2.gif" />';
	
 	var url = document.location.href;
	var message = document.getElementById("contact-message").value;	
	var objet = demande;	
	if(demande == "partenaire") var email_destinataire = "partenaire";
	else if(demande == "annonceur") var email_destinataire = "annonceur";
	else var email_destinataire = "visiteur";	
	if(document.getElementById("tel_test")) { var tel = document.getElementById("tel_test").value; } else{ var tel = trlg("C302", "non renseigné"); }	
	if((demande == "annonceur") || (demande == "partenaire")){	
		$.post("ajax/contact_annonceur.php", {email_destinataire: email_destinataire, url: url, message: message, nom: nom, email: email, tel: tel, objet: objet},
			function(data){
				$.scrollTo("#scroll_contact", {duration:800}, {top:'+=100px'} );
				$("#bloc_flottant").html(data);
				$(".ui-dialog-container").css({ width: 675, height: 200 });		
				$(".ui-dialog-content").css({ width: 675, height: 200 });
				setTimeout("if(fermer_av == 0){$('#bloc_flottant').dialog('close');}",8000);
			}
		); 			
	} else {
		$.post("ajax/contact_visiteur.php", {email_destinataire: email_destinataire, url: url, message: message, nom: nom, email: email, tel: tel, objet: objet},
			function(data){
				$.scrollTo("#scroll_contact", {duration:800}, {top:'+=100px'} );
				$("#bloc_flottant").html(data);
				$(".ui-dialog-container").css({ width: 675, height: 200 });		
				$(".ui-dialog-content").css({ width: 675, height: 200 });
				setTimeout("if(fermer_av == 0){$('#bloc_flottant').dialog('close');}",8000);
			}
		); 		
	}
}

function action_form_contact(id_inscrit,email,nom,objet){
	fermer_av = 0;
	
	document.getElementById("btn_contact_fixe").style.display = 'none';
	document.getElementById("btn_contact_load").innerHTML = '<img src="images/wait2.gif" />';
		
 	var url = document.location.href;
	var message = document.getElementById("contact-message").value;	
	var email_destinataire = test_email_destinataire();	
	if(document.getElementById("tel_test")) { var tel = document.getElementById("tel_test").value; } else{ var tel = trlg("C302", "non renseigné"); }	
	if((document.getElementById("partenaire").checked==true) || (document.getElementById("annonceur").checked==true)){	
		$.post("ajax/contact_annonceur.php", {email_destinataire: email_destinataire, url: url, message: message, nom: nom, email: email, tel: tel, objet: objet},
			function(data){
				$.scrollTo("#scroll_contact", {duration:800}, {top:'+=100px'} );
				$("#bloc_flottant").html(data);
				$(".ui-dialog-container").css({ width: 675, height: 200 });	
				$(".ui-dialog-content").css({ width: 675, height: 200 });	
				setTimeout("if(fermer_av == 0){$('#bloc_flottant').dialog('close');}",8000);			
			}
		); 			
	} else {
		$.post("ajax/contact_visiteur.php", {email_destinataire: email_destinataire, url: url, message: message, nom: nom, email: email, tel: tel, objet: objet},
			function(data){
				$.scrollTo("#scroll_contact", {duration:800}, {top:'+=100px'} );
				$("#bloc_flottant").html(data);
				$(".ui-dialog-container").css({ width: 675, height: 200 });		
				$(".ui-dialog-content").css({ width: 675, height: 200 });	
				setTimeout("if(fermer_av == 0){$('#bloc_flottant').dialog('close');}",8000);
			}
		); 		
	}	 
}
*/

//COMMUNAUTE AJOUT MEMBRE INSCRIT
function popin_invitation_com_interne(id_inscrit,partie) {
	action_ouverture_popin();
	$("#bloc_invit_interne_com").html(inject_wait(2, 50));        
	$.post("ajax/co_invitation_com_interne.php", { id_inscrit: id_inscrit, partie: partie },
		function(data){ $("#bloc_invit_interne_com").html('<div style="padding-top:15px;">'+data+'</div>'); }
	);	
	$("#bloc_invit_interne_com").dialog({
		resizable: false, 
		draggable: false,
		close: function(){
			fermer_av = 1;
			raffiche_selects_ie6();
		},
		dialogClass: "dialog_standard_bleu",
		width: 400,
		height: 300,
		modal: false
	});
	$('.ui-dialog-container').corner({
		tl:{radius:5},
		tr:{radius:5},
		bl:{radius:5},
		br:{radius:5},
		antiAlias:true,
		autoPad:false
	});	
	$(".ui-dialog-titlebar-close").blur();		
}
function action_com_invitation_interne(id_inscrit,partie) {
	if(document.getElementById("com_amis").checked  == true){ com_amis = document.getElementById("com_amis").value; } else{ com_amis = 0; }
	if(document.getElementById("com_travail").checked  == true){ com_travail = document.getElementById("com_travail").value; } else{ com_travail = 0; } 	
	if(document.forms.invit_mail.txt_perso.value == ""){ txt_perso = 0; } else{ txt_perso = document.forms.invit_mail.txt_perso.value; }
	if(document.getElementById("texte_invitation_init").value == document.getElementById("texte_invitation").value){ txt_perso = 0; }        
	action_com_invitation_interne_traitement(id_inscrit,com_amis,com_travail,txt_perso,partie);
}
function action_com_invitation_interne_traitement(id_inscrit,com_amis,com_travail,txt_perso,partie) {
	fermer_av = 0;
        
	$.post("ajax/co_invitation_com_interne_traitement.php", { id_inscrit: id_inscrit, com_amis: com_amis, com_travail: com_travail, txt_perso: txt_perso },
		function(data){ 
			switch(partie){
				case "c":
					document.getElementById("picto_invit_com_"+id_inscrit).innerHTML="<div style=\"height:20px;width:1px;\"></div>";
					break;
				case "me_contact":
					$.post("ajax/me_contact_co.php", { id_inscrit: id_inscrit, partie: partie },
						function(data)
						{
							var vecteur = data.split('##');
					    var id_inscrit = vecteur[0];
					    var commu = vecteur[1];
							
							// Actualisation de la partie communauté du contact
							$("#me_contact_"+id_inscrit).html(commu);
						}
					);
					break;
				case "me_convers":
					$.post("ajax/me_contact_co.php", { id_inscrit: id_inscrit, partie: partie },
						function(data)
						{
							var vecteur = data.split('##');
					    var commu = vecteur[1];
							
							// Actualisation de la partie communauté du contact
							$("#me_convers_communaute").html(commu);
						}
					);
					break;
			}
			$("#invit_mail").html(data); 
			$("#bloc_invit_interne_com").css({ height: 75 });	
			$(".ui-dialog-container").css({ height: 100 });		
			setTimeout("if(fermer_av == 0){$('#bloc_invit_interne_com').dialog('close');}",8000);
		}
	);	 
} 




function accueil_arrondi() {
	$('#cadre1').corner({
		tl:false,
		tr:{radius:10},
		bl:{radius:10},
		br:{radius:10},
		antiAlias:true,
		autoPad:false}
	);

	$("#home_maison").tooltip({
		showURL: false
	});

}

function ins_arrondi() {
	/*$('#inscription').corner({
		tl:{radius:15},
		tr:{radius:15},
		bl:{radius:15},
		br:{radius:15},
		antiAlias:true,
		autoPad:false}
	);*/
}




function affiche_test1() {
	var data = '<div>test!</div>';
	$("#bloc_flottant").html(data);
	$("#bloc_flottant").dialog({
		title: "toto",
		resizable: true, 
	    modal: true, 
		width: 350,
		height: 500,
		top: 50,
		position: "right",
		minwidth: 200,
		minHeight: 200
	});
	// arrondis
	$('.ui-dialog-titlebar').corner({
		tl:{radius:5},
		tr:{radius:5},
		bl:false,
		br:false,
		antiAlias:true,
		autoPad:false}
	);
	$('.ui-dialog-container').corner({
		tl:false,
		tr:false,
		bl:{radius:5},
		br:{radius:5},
		antiAlias:true,
		autoPad:false}
	);

/*
	$("#bloc_flottant").html(data);
	$("#bloc_flottant").dialog({ 
		dialogClass: "test_bug",
		resizable: false, 
		modal: true, 
		width: 500,
		height: 300,	
		overlay: { 
			opacity: 0.2, 
			background: "#000033" 
		}		
	});	 	

	$('.ui-dialog-container').corner({
		tl:{radius:5},
		tr:{radius:5},
		bl:{radius:5},
		br:{radius:5},
		antiAlias:true,
		autoPad:false}
	);*/
}





function lance_galerie_photo_pr()
{
	$('.gallerie_photo_unstyled').addClass('gallerie_photo'); // adds new class name to maintain degradability

	$('ul.gallerie_photo').galleria({
		history   : false, // activates the history object for bookmarking, back-button etc.
		clickNext : true, // helper for making the image clickable
		insert    : '#main_image', // the containing selector for our main image
		onImage   : function(image,caption,thumb) { // let's add some image effects for demonstration purposes
			
			// fade in the image & caption
			image.css('display','none').fadeIn(1000);
			caption.css('display','none').fadeIn(1000);
			
			// fetch the thumbnail container
			var _li = thumb.parents('li');
			
			// fade out inactive thumbnail
			_li.siblings().children('img.selected').fadeTo(500,0.3);
			
			// fade in active thumbnail
			thumb.fadeTo('fast',1).addClass('selected');
			
			// add a title for the clickable image
			image.attr('title','Next image >>');
		},
		onThumb : function(thumb) { // thumbnail effects goes here
			
			// fetch the thumbnail container
			var _li = thumb.parents('li');
			
			// if thumbnail is active, fade all the way.
			var _fadeTo = _li.is('.active') ? '1' : '0.3';
			
			// fade in the thumbnail when finnished loading
			thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
			
			// hover effects
			thumb.hover(
				function() { thumb.fadeTo('fast',1); },
				function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active
			)
		}
	});
}

var galpr_ouvert = 0;
function galpr_open() {
	modalClic('galpr', 'plus::onShow:galpr_open2(),persist:true');
}
function galpr_open2() {
	if (!galpr_ouvert){
		lance_galerie_photo_pr();
		galpr_ouvert = 1;
	}
}

function galpropen(id, im) {
	modalClic('galpr', 'plus::onShow:galpropen2("'+id+'","'+im+'"),persist:true');
}
function galpropen2(id, im) {
	$.get("ajax/pr_affiche_galerie.php", {id_i:id, num_p:im},
		function(data){
			$("#galpri").html(data);
			lance_galerie_photo_pr();
			var pos = document.documentElement.scrollTop + 10;
			$("#ModalContainer_galpr").css("top", pos);
		}
	);
}




function close_popin() { $("#bloc_flottant").dialog("close"); } //permet de fermer la fenetre popin avec un lien type annuler/fermer


function blocPShad() {
	$("#bloc_principal_blue").dropShadow({ 
		left: -5,
		top: 5,
		blur: 3,
		opacity: .2,
		color: "black"
	});
	//alert(1);
}




//PopIn aide pour le login
function explication_loggin(){
	if (document.getElementById('retour_erreur_login').style.display== "block"){
		document.getElementById('retour_erreur_login').style.display="none";
	}	
	$("#affiche_explication_loggin").html(inject_wait(2, 50));
	$.post("ajax/explication_loggin.php", {},
		function(data){
			$("#affiche_explication_loggin").css({ display: "block" });
			$("#affiche_explication_loggin").html("<div class=\"text_explication_loggin\">"+data+"</div>"); 
			document.getElementById('affiche_explication_loggin').style.border = "5px solid #999999"; 
			$("#affiche_explication_loggin").corner({
				tl:{radius:5},
				tr:{radius:5},
				bl:{radius:5},
				br:{radius:5},
				antiAlias:true,
				autoPad:false
			});
		 }			
	);
}
function explication_loggin_oubli(){
	$.post("ajax/explication_loggin_oubli.php", {},
		function(data){	$(".text_explication_loggin").html(data); }	
	);
}
function renvoi_password(){
	if(document.getElementById('renvoie_mot_pass').value != ""){
		var email = document.getElementById('renvoie_mot_pass').value;
		$.post("ajax/explication_loggin_recup_pass.php", { email: email},
			function(data){
				if(data == "erreur"){
					var message = trlg("C680","L'adresse email entrée ne correspond à aucun compte");
					$("#retour_explication_login_erreur").css({ display: "block"});
					$("#retour_explication_login_erreur").html(message);
					$("#renvoie_mot_pass").css({ borderColor: "#D2204C" });	
				}else{			
					$(".text_explication_loggin").html(data); 		
					$(".text_explication_loggin").css({	textAlign: "center" });	
					$("#affiche_explication_loggin").css({ height: "58" });
					setTimeout("ferme_bloc_explication_loggin()",10000);	
				}		
			}	
		);
	}else if(document.getElementById('renvoie_mot_pass').value == ""){
		var message = trlg("C693","Merci de compléter le champ email");
		$("#retour_explication_login_erreur").css({ display: "block"});
		$("#retour_explication_login_erreur").html(message);
		$("#renvoie_mot_pass").css({ borderColor: "#D2204C" });	
	}		
}
function ferme_bloc_explication_loggin(){
	if (document.getElementById('affiche_explication_loggin').style.display == "block"){
		document.getElementById('affiche_explication_loggin').innerHTML = "";
		document.getElementById('affiche_explication_loggin').style.display = "none";		
	}	
}


function vide_explication_login(){
	$("#retour_explication_login_erreur").css({ display: "none"});
	$("#retour_explication_login_erreur").html('');
	$("#renvoie_mot_pass").css({ borderColor: "#CCCCCC" });	
	$("#renvoie_mot_pass").html('');	
}

function inject_wait(taille, hspace) {
	var str = '<div style="text-align:center;padding:'+hspace+'px;"><img src="images/wait'+taille+'.gif"></div>';
	return str;
}





function call_fb_import_trajets(){
    $("#pin_ok").hide();
    var pin = $("#in_pin").val();
    var erreur = false;
    if(!pin){
        erreur=true;
        erreur2_affiche(pin_erreurs, "pin_vide");
    }
    if(!erreur){
        $("#pin_submit").hide();
        $("#pin_submit_load").show();
        $.post("ajax/action_controller.php", { action:'importerVolsFlyingBlue', pin:pin, retour:'code' }, function(data) {
            var arr = data.split(' ');
            if(arr[0] != 'erreur'){
                if(data=="0" || !data){
                    $("#pin_ok").show();
                }else{
                    /*if($("#ajout_voyage_lien2")){
                        document.location.href='vo.php?vmaj='+data;
                    }else{
                        $("#saisie_code_pin").hide();
                        $("#pin_ok2").show();
                    }*/

                    if($("#ajout_voyage_lien2")){
                        //affiche_fb_import_trajets(data);
                        affiche_fb_import_trajets(1);
                    }else{
                        $("#saisie_code_pin").hide();
                        //$("#pin_ok2").show();
                    }

					
                }
            }else{
                if(arr[1]=='wsv'){
                    erreur2_affiche(pin_erreurs, "pin_wsv");
                }else{
                    erreur2_affiche(pin_erreurs, "pin_invalide");
                }
            }
            $("#pin_submit_load").hide();
            $("#pin_submit").show();
        });
    }
    return false;
}

function affiche_fb_import_trajets(refresh) {
	action_ouverture_popin();
	$.get("ajax/fb_import_trajets_liste.php", {refresh:refresh},
		function(data){
			$("#bloc_flottant").html('<div style="padding-top:15px;">'+data+'</div>');
		}
	); 
	$("#bloc_flottant").dialog({ 
		dialogClass: "import_traj",
		close: function(){
			raffiche_selects_ie6();
		},
		resizable: false,		
		width: 580,
		height: 450,
		modal: false
	});	 	
	$('.ui-dialog-container').corner({
		tl:{radius:5},
		tr:{radius:5},
		bl:{radius:5},
		br:{radius:5},
		antiAlias:true,
		autoPad:false}
	);		
}

function import_traj_valide(boites, refresh) {
	var arr = boites.split(",");

	var param = "";
	for (var i=0; i<arr.length; i++) {
		if (arr[i]){
			var tr = arr[i];
			var obj = document.getElementById('import_traj_chk'+tr);
			if (obj){
				if (obj.checked){
					param = param + ";" + tr;
				}
			}
		}
	}

	if (param){
		$.get("ajax/fb_import_trajets_valide.php", {trs:param}, function() {
			$("#bloc_flottant").dialog("close");
			if (refresh){
				document.location.href='vo.php?vmaj='+refresh;
			}else{
				$("#pin_ok2").show();
			}
		});
	} else {
		$("#bloc_flottant").dialog("close");
	}

}





// fonctions consultation my bluenity
function mybnity_module_consult_suite(id) {
	//affiche('myblue_consult_blocksuite_'+id);
        $("#myblue_consult_blocksuite_"+id).slideDown("slow");
	affiche('myblue_consult_reduire_'+id);
	masque('myblue_consult_suite_'+id);
}

function mybnity_module_consult_reduire(id) {
	//masque('myblue_consult_blocksuite_'+id);
        $("#myblue_consult_blocksuite_"+id).slideUp("slow");
	masque('myblue_consult_reduire_'+id);
	affiche('myblue_consult_suite_'+id);
}


// init datepicker pour "mybluenity"
function init_datepckr(champ_base, min_jour, min_mois, min_a, max_jour, max_mois, max_a, champ_fin) {
	var base = champ_base.substring(0,4);
	var num = champ_base.substring(4,5);
	init_datepckr2(base, num, champ_fin, min_jour, min_mois, min_a, max_jour, max_mois, max_a, min_jour, min_mois, min_a, max_jour, max_mois, max_a);
}
function init_datepckr2(champ_base, num, champ_fin, min_jour1, min_mois1, min_a1, max_jour1, max_mois1, max_a1, min_jour2, min_mois2, min_a2, max_jour2, max_mois2, max_a2) {
	var champ = champ_base+num+champ_fin;
	if (num=="1") {
		var min_jour = min_jour1;
		var min_mois = min_mois1;
		var min_a = min_a1;
		var max_jour = max_jour1;
		var max_mois = max_mois1;
		var max_a = max_a1;
	} else {
		var min_jour = min_jour2;
		var min_mois = min_mois2;
		var min_a = min_a2;
		var max_jour = max_jour2;
		var max_mois = max_mois2;
		var max_a = max_a2;
	}

	//var str = $("#"+champ).val()

	$("#"+champ).datepicker({
		minDate: new Date(min_a, min_mois - 1, min_jour),
		maxDate: new Date(max_a, max_mois - 1, max_jour),
		yearRange: '2008:2020',
		shortYearCutoff: 100,
		mandatory: true,
		firstDay: 1,
		dateFormat: 'dd M y',
		//dateFormat: 'dd M yy',
		onSelect: function(dateText) {
			var d = $.datepicker.parseDate('dd M yy', dateText);
			var fd = $.datepicker.formatDate('yy-mm-dd', d);
			$("#"+champ+"_iso").val(fd);

			var arr = fd.split("-");
			if (num=="1"){
				var numn = "2";
				min_jour2 = arr[2];
				min_mois2 = arr[1];
				min_a2 = arr[0];
			} else {
				var numn = "1";
				max_jour1 = arr[2];
				max_mois1 = arr[1];
				max_a1 = arr[0];
			}
			var champn = champ_base+numn;
			$("#"+champn+champ_fin).datepicker("destroy");
			init_datepckr2(champ_base, numn, champ_fin, min_jour1, min_mois1, min_a1, max_jour1, max_mois1, max_a1, min_jour2, min_mois2, min_a2, max_jour2, max_mois2, max_a2)
		}
	});
}

function myblue_edit_visible_change(tr) {
	var obj = document.getElementById('myblue_edit_visible_chk_'+tr);
	if (obj.checked){
		$("#myblue_edit_inv_"+tr).fadeOut("fast", 
			function () {
				$("#myblue_edit_vis_"+tr).fadeIn("def");
			});
	} else {
		$("#myblue_edit_vis_"+tr).fadeOut("fast", 
			function () {
				$("#myblue_edit_inv_"+tr).fadeIn("def");
			});
	}
}


///////////////////////////////////////////
//COMMUNAUTE INVITATIONS PAR MAILS AUTRE QUE FAMILLE
///////////////////////////////////////////
function popin_invitation_mail() {
	action_ouverture_popin();
	$("#bloc_invit_com").html(inject_wait(2, 50));
	$.post("ajax/co_invitation_mail.php", 
		function(data){
			$("#bloc_invit_com").html('<div style="padding-top:15px;">'+data+'</div>');
		}
	);	
	$("#bloc_invit_com").dialog({ 
		resizable: false,		 
		draggable: false, 
		close: function(){
			fermer_av = 1;
			raffiche_selects_ie6();
		},
		dialogClass: "dialog_standard_bleu", 
		width: 650, 
		height: 500,
		modal: false
	});		
	$('.ui-dialog-container').corner({
		tl:{radius:5},
		tr:{radius:5},
		bl:{radius:5},
		br:{radius:5},
		antiAlias:true,
		autoPad:false
	});
	$(".ui-dialog-titlebar-close").blur();	
}

function action_com_invit_mail_af() {	
	var le_test_af = false;
	var txt_envoyer = document.getElementById("bt_envoyer_init").value;
	if(document.getElementById('mail_invit1').value != null){ 
		if(!verif_mail_air_france(document.getElementById('mail_invit1').value)){
			document.getElementById("message_add_af").innerHTML = trlg("C625", "Une ou plusieurs des adresses email saisies ne sont pas des adresses Air France KLM. Merci de les corriger ou les supprimer");	
			le_test_af = false;
			document.getElementById("change_btn").innerHTML = '<img class="png_trans" alt="" src="images/triangle_marine_droit.png"/> '+txt_envoyer;
		}else{
			document.getElementById("message_add_af").innerHTML = '';
			le_test_af = true;
		}
 	}else if(document.getElementById('mail_invit2').value != null){ 
		if(!verif_mail_air_france(document.getElementById('mail_invit2').value)){
			document.getElementById("message_add_af").innerHTML = trlg("C625", "Une ou plusieurs des adresses email saisies ne sont pas des adresses Air France KLM. Merci de les corriger ou les supprimer");	
			le_test_af = false;
			document.getElementById("change_btn").innerHTML = '<img class="png_trans" alt="" src="images/triangle_marine_droit.png"/> '+txt_envoyer;
		}else{
			document.getElementById("message_add_af").innerHTML = '';
			le_test_af = true;
		}
	}else if(document.getElementById('mail_invit3').value != null){ 
		if(!verif_mail_air_france(document.getElementById('mail_invit3').value)){
			document.getElementById("message_add_af").innerHTML = trlg("C625", "Une ou plusieurs des adresses email saisies ne sont pas des adresses Air France KLM. Merci de les corriger ou les supprimer");	
			le_test_af = false;
			document.getElementById("change_btn").innerHTML = '<img class="png_trans" alt="" src="images/triangle_marine_droit.png"/> '+txt_envoyer;
		}else{
			document.getElementById("message_add_af").innerHTML = '';
			le_test_af = true;
		}
	}else if(document.getElementById('mail_invit4').value != null){ 
		if(!verif_mail_air_france(document.getElementById('mail_invit4').value)){
			document.getElementById("message_add_af").innerHTML = trlg("C625", "Une ou plusieurs des adresses email saisies ne sont pas des adresses Air France KLM. Merci de les corriger ou les supprimer");	
			le_test_af = false;
			document.getElementById("change_btn").innerHTML = '<img class="png_trans" alt="" src="images/triangle_marine_droit.png"/> '+txt_envoyer;
		}else{
			document.getElementById("message_add_af").innerHTML = '';
			le_test_af = true;
		}
	}else if(document.getElementById('mail_invit5').value != null){ 
		if(!verif_mail_air_france(document.getElementById('mail_invit5').value)){
			document.getElementById("message_add_af").innerHTML = trlg("C625", "Une ou plusieurs des adresses email saisies ne sont pas des adresses Air France KLM. Merci de les corriger ou les supprimer");	
			le_test_af = false;
			document.getElementById("change_btn").innerHTML = '<img class="png_trans" alt="" src="images/triangle_marine_droit.png"/> '+txt_envoyer;
		}else{
			document.getElementById("message_add_af").innerHTML = '';
			le_test_af = true;
		}
	}	
	if(le_test_af == true){	
		document.getElementById("message_add_af").innerHTML = '';
		if(document.getElementById("com_amis").checked  == true){ com_amis = document.getElementById("com_amis").value; } else{ com_amis = 0; }
		if(document.getElementById("com_travail").checked  == true){ com_travail = document.getElementById("com_travail").value; } else{ com_travail = 0; } 	
		if(document.forms.invit_mail.email1 != null){ email1 = document.forms.invit_mail.email1.value; } else{ email1 = 0; }		
		if(document.forms.invit_mail.email2 != null){ email2 = document.forms.invit_mail.email2.value; } else{ email2 = 0; }		
		if(document.forms.invit_mail.email3 != null){ email3 = document.forms.invit_mail.email3.value; } else{ email3 = 0; }		
		if(document.forms.invit_mail.email4 != null){ email4 = document.forms.invit_mail.email4.value; } else{ email4 = 0; }		
		if(document.forms.invit_mail.email5 != null){ email5 = document.forms.invit_mail.email5.value; } else{ email5 = 0; }			
		if(document.forms.invit_mail.txt_perso.value == ""){ txt_perso = 0; } else{ txt_perso = document.forms.invit_mail.txt_perso.value; }
		if(document.getElementById("texte_invitation_init").value == document.getElementById("texte_invitation").value){ txt_perso = 0; }
		action_com_invit_mail_traitement(com_amis,com_travail,email1,email2,email3,email4,email5,txt_perso);
	}		
}

function action_com_invit_mail() {	
	if(document.getElementById("com_amis").checked  == true){ com_amis = document.getElementById("com_amis").value; } else{ com_amis = 0; }
	if(document.getElementById("com_travail").checked  == true){ com_travail = document.getElementById("com_travail").value; } else{ com_travail = 0; } 	
	if(document.forms.invit_mail.email1 != null){ email1 = document.forms.invit_mail.email1.value; } else{ email1 = 0; }		
	if(document.forms.invit_mail.email2 != null){ email2 = document.forms.invit_mail.email2.value; } else{ email2 = 0; }		
	if(document.forms.invit_mail.email3 != null){ email3 = document.forms.invit_mail.email3.value; } else{ email3 = 0; }		
	if(document.forms.invit_mail.email4 != null){ email4 = document.forms.invit_mail.email4.value; } else{ email4 = 0; }		
	if(document.forms.invit_mail.email5 != null){ email5 = document.forms.invit_mail.email5.value; } else{ email5 = 0; }			
	if(document.forms.invit_mail.txt_perso.value == ""){ txt_perso = 0; } else{ txt_perso = document.forms.invit_mail.txt_perso.value; }
	if(document.getElementById("texte_invitation_init").value == document.getElementById("texte_invitation").value){ txt_perso = 0; }
	action_com_invit_mail_traitement(com_amis,com_travail,email1,email2,email3,email4,email5,txt_perso);
}		
function action_com_invit_mail_traitement(com_amis,com_travail,email1,email2,email3,email4,email5,txt_perso) {
	fermer_av = 0;
	$.post("ajax/co_invitation_mail_traitement.php", { com_amis: com_amis, com_travail: com_travail, email1: email1, email2: email2, email3: email3, email4: email4, email5: email5, txt_perso: txt_perso },
		function(data){		
			$(".ui-dialog").css({ width: 650, height: 200 });
			$("#bloc_invit_com").css({ width: 640, height: 175 }); 
			$("#invit_mail").html(data);
			setTimeout("if(fermer_av == 0){$('#bloc_invit_com').dialog('close');}",7000);		
		}
	);	 
} 



//ouvre la popin de gestion d'un utilisateur dans ses communautés
function modifier_user(id_user,partie) {
	action_ouverture_popin();
	$("#bloc_modif_com").html(inject_wait(2, 50));
	$.post("ajax/co_modifier.php", { user: id_user, partie: partie },
		function(data){
			$("#bloc_modif_com").html('<div id="popin_modif_com">'+data+'</div>');
		}
	);
	$("#bloc_modif_com").dialog({ 
		resizable: false, 		 
		draggable: false, 
		close: function(){
			fermer_av = 1;
			raffiche_selects_ie6();
		},
		dialogClass: "dialog_standard_bleu", 
		width: 650, 
		height: 450,
		modal: false
	});	
	$('.ui-dialog-container').corner({
		tl:{radius:5},
		tr:{radius:5},
		bl:{radius:5},
		br:{radius:5},
		antiAlias:true,
		autoPad:false
	});
	$(".ui-dialog-titlebar-close").blur();		
} 
//actions éxécutées lorsque l'on valide la modification d'un utilisateur dans ses communautés
function action_com_modifier(id_inscrit,partie) {
	//récupère l'état des cases à cocher
	if(document.forms.form_modif_com.amis.checked == true) { valeur_amis = 1; }	
	else { valeur_amis = 0; }
	if(document.forms.form_modif_com.travail.checked == true) { valeur_travail = 1; }	
	else { valeur_travail = 0; }
	if(document.forms.form_modif_com.famille) {
		if(document.forms.form_modif_com.famille.checked == true) { valeur_famille = 1; }	
		else { valeur_famille = 0; }
	} 
	else { valeur_famille = 0; }
	
	//on test si rien est coché
	if (valeur_amis == 0 && valeur_travail == 0 && valeur_famille == 0) {
		//on récupère le nom de l'utilisateur que est en cours de gestion puis on affiche un message d'alerte
		$.post("ajax/co_recup_nom.php", { user: id_inscrit },
			function(data){
				$("#bloc_modif_com").css({ width: 630, height: 100 });	
				$(".ui-dialog-container").css({ width:640, height: 126 });	
				txt_conf = '<div class="float_left texte_centre" id="bloc_confirm_modif_com" style="padding-top:15px;">';
				txt_conf += '<div class="float_left texta12 gras">'+trlg("C286","Etes vous sur de vouloir enlever")+' '+data+' '+trlg("C287","de toutes vos communautés")+' ?</div>';
				txt_conf += '<div style="clear:both; width:1px; height:20px;"></div>';
				txt_conf += '<div class="float_left" id="lien_annuler_confirm_modif_com"><a class="lien_secondaire" onclick="close_generique(\'bloc_modif_com\');" href="javascript:void(0);"><img class="png_trans" alt="" src="images/triangle_gris_gauche.png"/> '+trlg("C650","non")+'</a></div>';
				txt_conf += '<div style="float:left; width:200px; height:1px;"></div>';			
				txt_conf += '<div class="float_left"><a class="lien_important" onclick="action_com_modifier_confirm('+id_inscrit+','+valeur_amis+','+valeur_travail+','+valeur_famille+',\''+partie+'\');" href="javascript:void(0);"><img class="png_trans" alt="" src="images/triangle_marine_droit.png"/> '+trlg("C649","oui")+'</a></div>';
				txt_conf += '</div>';				
				$("#resultat_action_modif").html(txt_conf);	 				
			}
		);			
	}	
	else {
		//puis éxécute le traitement via un autre fichier
		action_com_modifier_confirm(id_inscrit,valeur_amis,valeur_travail,valeur_famille,partie);
	}
}
//fonction qui execute le traitement lié à la gestion d'un utilisateur dans les communautés
function action_com_modifier_confirm(id_inscrit,valeur_amis,valeur_travail,valeur_famille,partie) {
	fermer_av = 0;	
	$.post("ajax/co_modifier_action.php", { user: id_inscrit, amis: valeur_amis, travail: valeur_travail, famille: valeur_famille },
		function(data){
			if(data == "nomodif"){
				$('#bloc_modif_com').dialog('close');
			}else{
				if(partie == 'c'){
					if (valeur_amis == 0 && valeur_travail == 1 && valeur_famille == 1) {
						document.getElementById("picto_modif_amis_"+id_inscrit).style.display = "none";
						document.getElementById("picto_modif_travail_"+id_inscrit).style.display = "block";
						document.getElementById("picto_modif_famille_"+id_inscrit).style.display = "block";
					}	
					if (valeur_amis == 1 && valeur_travail == 0 && valeur_famille == 1) {
						document.getElementById("picto_modif_amis_"+id_inscrit).style.display = "block";
						document.getElementById("picto_modif_travail_"+id_inscrit).style.display = "none";
						document.getElementById("picto_modif_famille_"+id_inscrit).style.display = "block";
					}	
					if (valeur_amis == 0 && valeur_travail == 0 && valeur_famille == 1) {
						document.getElementById("picto_modif_amis_"+id_inscrit).style.display = "none";
						document.getElementById("picto_modif_travail_"+id_inscrit).style.display = "none";
						document.getElementById("picto_modif_famille_"+id_inscrit).style.display = "block";
					}	
					if (valeur_amis == 1 && valeur_travail == 1 && valeur_famille == 0) {
						document.getElementById("picto_modif_amis_"+id_inscrit).style.display = "block";
						document.getElementById("picto_modif_travail_"+id_inscrit).style.display = "block";
						document.getElementById("picto_modif_famille_"+id_inscrit).style.display = "none";
					}	
					if (valeur_amis == 1 && valeur_travail == 1 && valeur_famille == 1) {
						document.getElementById("picto_modif_amis_"+id_inscrit).style.display = "block";
						document.getElementById("picto_modif_travail_"+id_inscrit).style.display = "block";
						document.getElementById("picto_modif_famille_"+id_inscrit).style.display = "block";
					}	
					if (valeur_amis == 1 && valeur_travail == 0 && valeur_famille == 0) {
						document.getElementById("picto_modif_amis_"+id_inscrit).style.display = "block";
						document.getElementById("picto_modif_travail_"+id_inscrit).style.display = "none";
						document.getElementById("picto_modif_famille_"+id_inscrit).style.display = "none";
					}	
					if (valeur_amis == 0 && valeur_travail == 1 && valeur_famille == 0) {
						document.getElementById("picto_modif_amis_"+id_inscrit).style.display = "none";
						document.getElementById("picto_modif_travail_"+id_inscrit).style.display = "block";
						document.getElementById("picto_modif_famille_"+id_inscrit).style.display = "none";
					}
					if (valeur_amis == 0 && valeur_travail == 0 && valeur_famille == 0) {
						document.getElementById("user_"+id_inscrit).style.display = "none";
					}					
				}	
				else if(partie == 'me_contact'){
					$.post("ajax/me_contact_co.php", { id_inscrit: id_inscrit, partie: partie },
						function(data){
							var vecteur = data.split('##');
							var id_inscrit = vecteur[0];
							var commu = vecteur[1];
							
							// Actualisation de la partie communauté du contact
							$("#me_contact_"+id_inscrit).html(commu);
						}
					);
				}
				else if(partie == 'me_convers'){
					$.post("ajax/me_contact_co.php", { id_inscrit: id_inscrit, partie: partie },
						function(data)
						{
							var vecteur = data.split('##');
					    var commu = vecteur[1];
							
							// Actualisation de la partie communauté du contact
							$("#me_convers_communaute").html(commu);
						}
					);
				}
				$("#resultat_action_modif").html(data);	 
				$("#bloc_modif_com").css({ width: 630, height: 100 });	
				$(".ui-dialog-container").css({ width:640, height: 126 });	
				setTimeout("if(fermer_av == 0){$('#bloc_modif_com').dialog('close');}",7000);
			}
		}	
	);	
} 
//gestion des alertes lorsque l'on coche la case supprimer dans la fenetre de gestion d'un utilisateurs lié à ses communautés
function alerte_supp_com(id_inscrit) {
	//si supprimer est cocher on décoche toute les autres case
 	if(document.forms.form_modif_com.supp.checked == true) {	
		document.forms.form_modif_com.supp.checked = true;
		document.forms.form_modif_com.amis.checked = false;
		document.forms.form_modif_com.travail.checked = false;
		document.getElementById("infos_action_supp").innerHTML = " ";
		document.getElementById("infos_modif").innerHTML = " ";
		if(document.forms.form_modif_com.famille) document.forms.form_modif_com.famille.checked = false;
		//on récupère le nom de l'utilisateur qui est en cours de gestion puis on affiche un message d'alerte
		$.post("ajax/co_recup_nom.php", { user: id_inscrit },
			function(data){
				//txt_conf = trlg("C303","Etes vous sur de vouloir supprimer")+' '+data+' ?';
				txt_conf = trlg("C432","Si vous retirez une personne de toutes les communautés vous ne pourrez plus entrer en contact avec elle (sauf si celle-ci fait encore partie de vos Contacts dans la Messagerie).");
				$("#infos_action_supp").html(txt_conf);	  
			}
		);		
	}	
	//on remet l'état normal si le case supprimer est décoché
	if(document.forms.form_modif_com.supp.checked == false) {
		document.forms.form_modif_com.supp.checked = false;
		$("#infos_action_supp").html(" ");	 
	}	 
}


function popin_message(id_inscrit) {
	action_ouverture_popin();
	$("#bloc_flottant").html(inject_wait(2, 50));
	fermer_av = 0;
	$.post("ajax/me_profil.php", { id_inscrit: id_inscrit },
		function(data){ 
			$("#bloc_flottant").html('<div style="padding-top:15px;">'+data+'</div>'); 			
		}
	);	
	$("#bloc_flottant").dialog({
		resizable: false, 
		draggable: false,
		close: function(){
			fermer_av = 1;
			raffiche_selects_ie6();
		},
		dialogClass: "dialog_standard_bleu",
		width: 400,
		height: 200,
		modal: false
	});
	$('.ui-dialog-container').corner({
		tl:{radius:5},
		tr:{radius:5},
		bl:{radius:5},
		br:{radius:5},
		antiAlias:true,
		autoPad:false
	});
	$(".ui-dialog-titlebar-close").blur();		
}


function boite_avant_premiere(){
	action_ouverture_popin();
	fermer_av = 0;
	$("#bloc_avant_premiere").dialog({
		resizable: false, 
		draggable: false,
		dialogClass: "boite_avant_premiere",
		close: function(){
			fermer_av = 1;
			raffiche_selects_ie6();
		},
		width: 400,
		height: 80,
		modal: false
	});
	$('.ui-dialog-container').corner({
		tl:{radius:5},
		tr:{radius:5},
		bl:{radius:5},
		br:{radius:5},
		antiAlias:true,
		autoPad:false}
	);
	$(".ui-dialog-titlebar-close").blur();	
	var data = '<div class="gras texte12 blue3 texte_centre" style="padding-left:30px; padding-right:30px; padding-top:15px;">'+trlg("C634","Cette fonction sera disponible à l'ouverture publique le 4 novembre.")+'</div>';
	$("#bloc_avant_premiere").html(data);
	setTimeout("if(fermer_av == 0){$('#bloc_avant_premiere').dialog('close');}",7000);
}

function action_form_beta(){
	var email = document.getElementById("email").value;	
	$.post("ajax/form_beta.php", { email: email },
		function(data){
			$("#form_beta").html(data);
		}
	); 	 
}


function close_generique(id_bloc) { $("#"+id_bloc).dialog("close"); }


function trip_consult_open() {
	var pos = document.documentElement.scrollTop + 10;
	modalClic('q_trip_consult', 'plus::persist:true');
	$("#ModalContainer_q_trip_consult").css("top", pos);
}



function refuse_invit_com(el_wn,id_user,id_com) {
	$.post("ajax/co_refuse_membre.php", { user: id_user, com: id_com, el_wn: el_wn },
		function(data){
			$("#bloc_invit_com_pr_"+el_wn).fadeOut("normal");
			document.getElementById("bloc_demande_"+el_wn).innerHTML = " ";
			$.get("ajax/co_genere_menu_gauche.php", { actu_force: "1" },
				function(data){
					$("#menu_genere").html(data);
				});
	 			
		}
	);
}

//permet de valider une invitation reçut
function accept_invit_com(el_wn,id_user,id_com,libelle) {
	$.post("ajax/co_recup_nom.php", { user: id_user }, function(data){	nom = data;	});
	$.post("ajax/co_accept_membre.php", { user: id_user, com: id_com, el_wn: el_wn },
		function(data){
			document.getElementById("bloc_invit_com_pr_"+el_wn).innerHTML = " ";
			document.getElementById("bloc_demande_"+el_wn).innerHTML = " ";
			document.getElementById("reponse_invit").innerHTML = nom+" "+trlg("C696","est maintenant dans votre communauté")+" "+libelle;	
			$.get("ajax/co_genere_menu_gauche.php", { actu_force: "1" },
				function(data){
					$("#menu_genere").html(data);
				});

		}
	);
}


function pr_retour_carte(){
	$.scrollTo("#pr_inj_pays", 800);
}
function pr_scroll_bp(){
	$.scrollTo("#pr_inj_bp_data", 800);
}	

function affiche_infos_ext(){		
	if((document.getElementById("com_amis").checked==true) && (document.getElementById("com_travail").checked==true)){
		document.getElementById("infos_action").innerHTML = trlg("C438","verra votre profil Loisirs et Affaires");
	}		
	else if(document.getElementById("com_amis").checked==true){
		document.getElementById("infos_action").innerHTML = trlg("C439","verra votre profil Loisirs");
	}

	else if(document.getElementById("com_travail").checked==true){
		document.getElementById("infos_action").innerHTML = trlg("C440","verra votre profil Affaires");
	}	
	else{
		document.getElementById("infos_action").innerHTML = "";
	}
}


function affiche_infos(nom_inscrit){		
	if((document.getElementById("com_amis").checked==true) && (document.getElementById("com_travail").checked==true)){
		document.getElementById("infos_modif").innerHTML = nom_inscrit+" "+trlg("C441","voit votre profil Loisirs et Affaires");
		document.getElementById("infos_action_supp").innerHTML = "";
		document.getElementById("supp").checked=false;
	}		
	else if(document.getElementById("com_amis").checked==true){
		document.getElementById("infos_modif").innerHTML = nom_inscrit+" "+trlg("C442","voit votre profil Loisirs");
		document.getElementById("infos_action_supp").innerHTML = "";
		document.getElementById("supp").checked=false;
	}

	else if(document.getElementById("com_travail").checked==true){
		document.getElementById("infos_modif").innerHTML = nom_inscrit+" "+trlg("C443","voit votre profil Affaires");
		document.getElementById("infos_action_supp").innerHTML = "";
		document.getElementById("supp").checked=false;
	}	
	else{
		document.getElementById("infos_modif").innerHTML = "";
		document.getElementById("infos_action_supp").innerHTML = "";
		document.getElementById("supp").checked=false;
	}
}





function actusession() {
	setTimeout('actusession1()', 60000);
}
function actusession1() {
	/*$.get("ajax/actusession.php",
		function(data){
			actusession();
		}
	);*/
	$.get("ajax/actusession.php");
	actusession();
}


function action_ouverture_popin(){
	
	var boites = new Array();
	
	//chaque élément du tableau contient l'identifiant de la popin à fermer
	boites[0] = "bloc_bug";
	boites[1] = "bloc_faq";
	boites[2] = "bloc_flottant";
	boites[3] = "bloc_avant_premiere";
	boites[4] = "bloc_modif_com";
	boites[5] = "bloc_invit_com";
	boites[6] = "bloc_invit_interne_com";	
	boites[7] = "bloc_id_famille_com";
	boites[8] = "bloc_invit_com_famille";
	boites[9] = "bloc_gestion_id_famille_com";
	boites[10] = "bloc_confirmation";
	
	var i = 0;
	while(i < boites.length){
		$("#"+boites[i]+"").dialog("close");
		i++;
	}	
	masque_selects_ie6();	
}



function ouvre_inscription_mini(invitci){
	if(document.getElementById("bloc_formmini")){
		$.post("ajax/inscription_mini.php", { invitci: invitci }, 
			function(data){	
				document.getElementById("bloc_formmini").innerHTML = data;	
				document.getElementById("inscription-bas-mini").style.marginTop = "0px";
			}
		);
	}
}


var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
function recup_resolution(){
	var reso = screen.width +"x"+ screen.height; 
	$.post("ajax/info_resolution.php", { reso: reso }, function(data){} );
}

function recup_navigateur(){
	BrowserDetect.init();
	//navigateur = navigator.appCodeName+" - "+navigator.appName+" "+navigator.appVersion;
	navigateur = BrowserDetect.browser+" "+BrowserDetect.version
	$.post("ajax/info_navigateur.php", { navigateur: navigateur }, function(data){} );
}

function recup_os(){
	//os = navigator.platform; 
	BrowserDetect.init();
	os = BrowserDetect.OS;
	$.post("ajax/info_os.php", { os: os }, function(data){} );
}

function on_drapeau(lg){
	document.getElementById("lg_drapeau_"+lg+"_off").style.display = "none";
	document.getElementById("lg_drapeau_"+lg+"_on").style.display = "block";
}
function off_drapeau(lg){
	if(tempo_lg_memo != lg){
		document.getElementById("lg_drapeau_"+lg+"_on").style.display = "none";
		document.getElementById("lg_drapeau_"+lg+"_off").style.display = "block";	
	}	
}



function affiche_popin_endnl() {
	action_ouverture_popin();
	$.get("ajax/popin_endnl.php",
		function(data){
			$("#bloc_flottant").html('<div style="padding-top:15px;">'+data+'</div>');
			$(".ui-dialog-titlebar-close").blur();
		}
	); 
	$("#bloc_flottant").dialog({ 
		dialogClass: "import_traj",
		close: function(){
			raffiche_selects_ie6();
		},
		resizable: false,		
		width: 580,
		height: 450,
		modal: false
	});	 	
	$('.ui-dialog-container').corner({
		tl:{radius:5},
		tr:{radius:5},
		bl:{radius:5},
		br:{radius:5},
		antiAlias:true,
		autoPad:false}
	);		
}



function erreur2_affiche(tableau,id,styleNormal,styleErreur){
    if(!styleNormal){
        styleNormal = "champ_style2";
    }
    if(!styleErreur){
        styleErreur = "champ_style2_erreur";
    }
    var nom_div = "#"+tableau[id]["div"];
    $(nom_div).parent().children(".zone_explication").hide();
    $(nom_div).fadeIn("fast");
    $(nom_div).children("span[name='"+id+"']").show();
    for ( var j in tableau[id]["champs"] ){
        $("#"+tableau[id]["champs"][j]).removeClass(styleNormal);
        $("#"+tableau[id]["champs"][j]).addClass(styleErreur);
    }
}

function erreur2_masque(tableau,id){
    var nom_div = "#"+tableau[id]["div"];
    $(nom_div).fadeOut("fast", function(){
        $(nom_div).children().hide();
        if($(nom_div).parent().children(".erreur:visible").length==0){
            $(nom_div).parent().children(".zone_explication").show();
        }
    });
    for ( var j in tableau[id]["champs"] ){
        $("#"+tableau[id]["champs"][j]).removeClass("champ_style2_erreur");
        $("#"+tableau[id]["champs"][j]).addClass("champ_style2");
    }
}

function preremplir_init(){
    $(".prerempli2").each(function(i){
        var contenu = $(this).val();
        $(this).bind('focus',function(){
            if($(this).val()==contenu){
                $(this).val("");
                $(this).removeClass("prerempli2");
            }
        });
        $(this).bind('blur',function(){
            if($(this).val()==""){
                $(this).val(contenu);
                $(this).addClass("prerempli2");
            }
        });
    });
}





// Change l'image de la maison dans le menu (Blue Version 2)
function changer_home_v2(num,test)
{
	if( (document.images)&&(test == 0) )
	{
		tab_images = new Array();
		tab_images[0]= new Image();
		tab_images[1]= new Image();
		tab_images[0].src = 'images/home_deselect.gif';
		tab_images[1].src = 'images/home_select.gif';

		document.getElementById('home_maison').src = tab_images[num].src;
	}
}

// Change l'image de fond d'une rubrique du menu (Blue Version 2)
function changer_menu_fond_v2(num,rubrique,test)
{
    // Si la rubrique n'est pas sélectionnée
    if (test == 0)
    {
        if(num == 0)
        {
            $('#divmenu_'+rubrique).removeClass('menu_rubrique_select').addClass('menu_rubrique_deselect');
            if (document.getElementById(rubrique+'_fleche'))
                document.getElementById(rubrique+'_fleche').src = 'images/fleche_deselect.gif';
        }
        else
        {
            $('#divmenu_'+rubrique).removeClass('menu_rubrique_deselect').addClass('menu_rubrique_select');
            if (document.getElementById(rubrique+'_fleche'))
                document.getElementById(rubrique+'_fleche').src = 'images/fleche_select.gif';
        }
    }
}

// Affiche le sous menu
function affiche_ss_menu(rubrique)
{
    document.getElementById('sm_'+rubrique).style.display = 'block';
    //$("#sm_"+rubrique).slideDown("fast");
}

// masque le sous menu
function masque_ss_menu(rubrique)
{
    document.getElementById('sm_'+rubrique).style.display = 'none';
    //$("#sm_"+rubrique).slideUp();
}

