var CPT_RADAR = 0;
/*
confirmation url
*/
function ConfirmationUrl(msg, url)
{
	var input = confirm(msg)
	
	if (input)
		document.location = url;
}





   function getPosition(id)
   {
    obj = document.getElementById(id);
     var x=0,y=0;
     while (obj!=null)
     {
       x+=obj.offsetLeft-obj.scrollLeft;
       y+=obj.offsetTop-obj.scrollTop;
       obj=obj.offsetParent;
     }
     return {x:x,y:y};
   }
   
   
   function showDetailCvmap(id,iddetail)
   {
        
    obj = $(id).get(0);
     var x=0,y=0;
     while (obj!=null)
     {
       x+=obj.offsetLeft-obj.scrollLeft;
       y+=obj.offsetTop-obj.scrollTop;
       obj=obj.offsetParent;
     }
     $(iddetail).css({left:x,top:y}).show();
   }
   function hideDetailCvmap(id)
   {
    $(id).hide()
   }

 /*  function getMousePos(e) {

  if (document.all) {
  posX=event.x+document.body.scrollLeft; //modifs CL 09/2001 - IE : regrouper l'évènement
  posY=event.y+document.body.scrollTop;
  }
  else {
  posX=e.pageX; //modifs CL 09/2001 - NS6 : celui-ci ne supporte pas e.x et e.y
  posY=e.pageY; 
  }
 
}*/
   
   
  //affiche le mot clé selectionné dans le champ de recherche
  function set_suggest(s){
   document.getElementById('keyword__').value = s;
   document.getElementById('suggest').style.display = 'none';
  }
  function SuggestSubmit(url)
  {
    document.getElementById('suggest').style.display = 'none';
    var key = document.getElementById('keyword__').value;
    ajaxDisplay(url+'skinPage=Empty&SuggestSearch='+key,'search');
  }
  function suggestSearch(url,id,id_div)
  {
   document.getElementById('suggest').style.left = getPosition(id).x+2;
   if (navigator.appName=='Microsoft Internet Explorer') document.getElementById('suggest').style.top = getPosition(id).y+25;
   document.getElementById('suggest').style.width = document.getElementById(id).clientWidth;
    var keyword = document.getElementById(id).value;
    ajaxDisplay(url+keyword,id_div);
  }
/*
 functions javascripts des pages du site
*/
function gestionAffichageAlterne (tabParam){ 
	for (i=0;i<tabParam.length;i++)
	{
//		$("#"+tabParam[i]).toggle();
		if (document.getElementById(tabParam[i]).style.display == 'none')
		{
			$("#"+tabParam[i]).slideDown("fast");
//			document.getElementById(tabParam[i]).style.display = 'block';
		}
		else
		{
			if (document.getElementById(tabParam[i]).style.display =="")
			{
//				document.getElementById(tabParam[i]).style.display = 'block';
				$("#"+tabParam[i]).slideDown("fast");
			}
			else
			{
//				document.getElementById(tabParam[i]).style.display = 'none';
				$("#"+tabParam[i]).slideUp("fast");
			}					
		}
	}
}
function ajaxDisplayAlterne (url,divName) {
  
  if (document.getElementById(divName).style.display == 'block')
  {
   document.getElementById(divName).style.display = 'none';
   
  }
  else
     ajaxDisplay (url,divName);
}
function ajaxDisplay (url,divName) {
	document.getElementById(divName).style.display = 'block';
	if (url == "vider")
	{
		document.getElementById(divName).innerHTML = '';
	}
	else if (url == "radar")
	{
	 url = document.getElementById('radar').firstChild.getAttribute('src').split('?')[0];
	 url = url + "?id="+CPT_RADAR;
	 CPT_RADAR += 1;
    document.getElementById('radar').firstChild.setAttribute('src',url);
  }
  else
	{
		var xhr = null; 
		if (window.XMLHttpRequest) // Firefox 
		   xhr = new XMLHttpRequest(); 
		else if (window.ActiveXObject) // Internet Explorer 
		   xhr = new ActiveXObject("Microsoft.XMLHTTP"); 
		else 
		{// XMLHttpRequest non supporté par le navigateur 
		   document.getElementById(divName).innerHTML =  '<div id="' + divName + '" style="width:100%;overflow:auto;">Votre navigateur ne supporte pas les objets XMLHTTPRequest.<br>Nous vous conseillons de le mettre à jour.</div>'; 
		   return; 
		}
	 	xhr.open("GET", url, true);
		xhr.onreadystatechange  = function () 
		{
			if (xhr.readyState == 4)
				if (xhr.status == 200)
					document.getElementById(divName).innerHTML = xhr.responseText;
		}
		xhr.send(null);
	}
}

function ajaxSubmit(form,url,div)
{
	var variables = form.elements;
	for (i=0; i < variables.length ; i++)
	{
	 if (variables[i].multiple)
	 {
    for (j=0; j < variables[i].length; j++)
    {
      if (variables[i].options[j].selected)
      {
        var value = variables[i].options[j].value;
    		value = value.replace('/','-');
    		value = value.replace('&','');
    		value = value.replace('#','');
    		value = value.replace('’',"'");
    		value = value.replace('…',"...");
    		url = url+'&'+variables[i].name+'='+value;
      }
    }
   }
   else
   {
		var value = variables[i].value;
		while (value.indexOf('?') != -1)
			value = value.replace('?','%3F');
		while (value.indexOf('/') != -1)
			value = value.replace('/','-');
		while (value.indexOf('&') != -1)
			value = value.replace('&','');
		while (value.indexOf('#') != -1)
			value = value.replace('#','');
		while (value.indexOf('’') != -1)
			value = value.replace('’',"'");
		while (value.indexOf('…') != -1)
			value = value.replace('…',"...");
		while (value.indexOf("\r\n") != -1)
			value = value.replace("\r\n","<br>");
		while (value.indexOf("\n") != -1)
			value = value.replace("\n", "<br>");
		while (value.indexOf("\r") != -1)
			value = value.replace("\r","<br>");
		url = url+'&'+variables[i].name+'='+value;
	 }
	}
	ajaxDisplay(url,div);
}

// fonction qui verifie les infos et valide le formulaire si tout est ok (CONNECTION)
function verif_connection () {
	var message = "";
	var pass = document.frmConnection.password.value;
	var email = document.frmConnection.email.value;
	var arobase = email.split("@");
	var point = email.split(".");
	var reg = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]{2,}[.][a-zA-Z]{2,4}$/
	
	// verif que les champs ne sont pas vides
	if (reg.exec(email) == null){
		message += "L'adresse e-mail n'est pas valide : veuillez saisir une adresse e-mail valide.   \r\n";
		document.frmConnection.email.focus();
		alert(message);
		return false;
	}
	if (email == ""){
		message += " L'adresse e-mail n'a pas été saisie : ce champs est obligatoire.   \n\r";

		document.frmConnection.email.focus();
		alert(message);
		return false;
	}
	if ((arobase.length < 2) || (point.length < 2)){
		message += "L'adresse e-mail n'est pas valide : veuillez saisir une adresse e-mail valide.   \r\n";
		document.frmConnection.email.focus();
		alert(message);
		return false;
	}
	if (pass == ""){
		message += "Le password n'a pas été saisi : ce champs est obligatoire.   \n\r";
		document.frmConnection.password.focus();
		alert (message);
		return false;
	}
}

//////////////////////////////////////////////
// Verification du formulaire d'inscription
//////////////////////////////////////////////
function verifFormu(formulaire, contexte){
	var reg = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,4}$/
	
	var message = '';
	var email = formulaire.email.value;
	
	
	
	if (contexte == 'interet'){
		
	}

	if (contexte == '360'){
		if (formulaire.prenom.value == ''){
			message = "Le prénom est obligatoire   \r\n";
			formulaire.prenom.focus();
			alert(message);
			return false;
		}
		
		if (formulaire.nom.value == ''){
			message = "Le nom est obligatoire.   \r\n";
			formulaire.nom.focus();
			alert(message);
			return false;
		}
	}	
	
	
	if (email == ''){
		message = "L'adresse e-mail est obligatoire.   \r\n";
		formulaire.email.focus();
		alert(message);
		return false;
	}
	
	if (reg.exec(email) == null){
		message = "L'adresse e-mail n'est pas valide : veuillez saisir une adresse e-mail valide.   \r\n";
		formulaire.email.focus();
		alert(message);
		return false;
	}
}

//////////////////////////////////////////////////////////////////
// fonction qui valide les parties une par une du 2eme test tricam
//////////////////////////////////////////////////////////////////

function verif_click2 (prems_id, deuz_id, etape1_id, etape2_id) {
	if ($("input:checked[name=que2_1]").val())
		alert("->" + $("input:checked[name=que2_1]").val());
	else
		alert("non défini");
		/*
	if (prems_id == "partie_1") {
		var temoin = 0;
		var choix = $("input:checked[name=que2_1]").val();
		if (choix)
		{
			temoin++
			var val1 = choix;
		}
		var choix = $("input:checked[name=que2_2]").val();
		if (choix)
		{
			temoin++
			var val2 = choix;
		}
		var choix = $("input:checked[name=que2_3]").val();
		if (choix)
		{
			temoin++
			var val3 = choix;
		}
		var choix = $("input:checked[name=que2_4]").val();
		if (choix)
		{
			temoin++
			var val4 = choix;
		}
		var choix = $("input:checked[name=que2_5]").val();
		if (choix)
		{
			temoin++
			var val5 = choix;
		}
		var choix = $("input:checked[name=que2_6]").val();
		if (choix)
		{
			temoin++
			var val6 = choix;
		}
		var choix = $("input:checked[name=que2_7]").val();
		if (choix)
		{
			temoin++
			var val7 = choix;
		}
		var choix = $("input:checked[name=que2_8]").val();
		if (choix)
		{
			temoin++
			var val8 = choix;
		}
		var choix = $("input:checked[name=que2_9]").val();
		if (choix)
		{
			temoin++
			var val9 = choix;
		}
		var choix = $("input:checked[name=que2_10]").val();
		if (choix)
		{
			temoin++
			var val10 = choix;
		}
		if (temoin == 10) {
			var result = val1+":"+val2+":"+val3+":"+val4+":"+val5+":"+val6+":"+val7+":"+val8+":"+val9+":"+val10+":";
			document.frmProfil2.tricam2_1.value = result;
			
			document.getElementById('partie_1').style.display='none';
			document.getElementById('partie_2').style.display='block';
		}
	}
	if (prems_id == "partie_2") 
	{
		var temoin = 0;
		var choix = document.frmProfil2.que2_11;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val1 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_12;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val2 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_13;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val3 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_14;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val4 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_15;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val5 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_16;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val6 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_17;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val7 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_18;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val8 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_19;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val9 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_20;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val10 = choix[i].value;
			}
		}
		if (temoin == 10) {
			var result = val1+":"+val2+":"+val3+":"+val4+":"+val5+":"+val6+":"+val7+":"+val8+":"+val9+":"+val10+":";
			document.frmProfil2.tricam2_2.value = result;
			//prems.style.display = 'none';
			//deuz.style.display = '';
			//etape1.style.display = 'none';
			//etape2.style.display = '';
			document.getElementById('partie_2').style.display='none';
			document.getElementById('partie_3').style.display='block';
		}
	}
	if (prems_id == "partie_3") {
		var temoin = 0;
		var choix = document.frmProfil2.que2_21;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val1 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_22;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val2 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_23;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val3 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_24;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val4 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_25;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val5 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_26;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val6 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_27;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val7 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_28;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val8 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_29;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val9 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_30;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val10 = choix[i].value;
			}
		}
		if (temoin == 10) {
			var result = val1+":"+val2+":"+val3+":"+val4+":"+val5+":"+val6+":"+val7+":"+val8+":"+val9+":"+val10+":";
			document.frmProfil2.tricam2_6.value = result;
			document.frmProfil2.submit();
		}
	}*/
}

function verif_click (prems, deuz, etape1, etape2) {
//	alert("verif");
//	alert("->" + $("input:checked[name=que2_1]").val());
	if (prems.id == "partie_1") {
		var temoin = 0;
		var choix = document.frmProfil2.que2_1;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val1 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_2;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val2 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_3;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val3 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_4;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val4 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_5;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val5 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_6;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val6 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_7;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val7 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_8;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val8 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_9;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val9 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_10;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val10 = choix[i].value;
			}
		}
		if (temoin == 10) {
			var result = val1+":"+val2+":"+val3+":"+val4+":"+val5+":"+val6+":"+val7+":"+val8+":"+val9+":"+val10+":";
			document.frmProfil2.tricam2_1.value = result;
			//prems.style.display = 'none';
			//deuz.style.display = '';
			//etape1.style.display = 'none';
			//etape2.style.display = '';
			document.getElementById('partie_1').style.display='none';
			document.getElementById('partie_2').style.display='block';
		}
	}
	if (prems.id == "partie_2") 
	{
		var temoin = 0;
		var choix = document.frmProfil2.que2_11;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val1 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_12;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val2 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_13;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val3 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_14;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val4 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_15;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val5 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_16;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val6 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_17;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val7 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_18;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val8 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_19;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val9 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_20;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val10 = choix[i].value;
			}
		}
		if (temoin == 10) {
			var result = val1+":"+val2+":"+val3+":"+val4+":"+val5+":"+val6+":"+val7+":"+val8+":"+val9+":"+val10+":";
			document.frmProfil2.tricam2_2.value = result;
			//prems.style.display = 'none';
			//deuz.style.display = '';
			//etape1.style.display = 'none';
			//etape2.style.display = '';
			document.getElementById('partie_2').style.display='none';
			document.getElementById('partie_3').style.display='block';
		}
	}
	if (prems.id == "partie_3") {
		var temoin = 0;
		var choix = document.frmProfil2.que2_21;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val1 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_22;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val2 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_23;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val3 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_24;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val4 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_25;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val5 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_26;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val6 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_27;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val7 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_28;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val8 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_29;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val9 = choix[i].value;
			}
		}
		var choix = document.frmProfil2.que2_30;
		for (var i = 0; i < choix.length; i++) {
			if (choix[i].checked == true) {
				temoin++;
				var val10 = choix[i].value;
			}
		}
		if (temoin == 10) {
			var result = val1+":"+val2+":"+val3+":"+val4+":"+val5+":"+val6+":"+val7+":"+val8+":"+val9+":"+val10+":";
			document.frmProfil2.tricam2_3.value = result;
			document.frmProfil2.submit();
		}
	}
}

function doc() {
	var formulaire 	= document.question;
	var formulaire2 = document.documents;

	formulaire2.titre.value 	= formulaire.titre.value;
	formulaire2.addCategorie.value 	= formulaire.addCategorie.value;
	formulaire2.categorie.value 	= formulaire.categorie.value;
	formulaire2.question.value 		= formulaire.question.value;

	formulaire2.submit();
}
//////////////////////////////////////////////////////////////////
// fonction qui permet d'afficher les types de diplome suivant 
// Le niveau d'étude choisi
//////////////////////////////////////////////////////////////////
function aff_type(val)
{ 
   $("#aff_typ").load("ajout-etape",
       {
       type : val,
       action:"aff_typ"}
       );
}

function aff_type_part(val, adr)
{
	$.post( adr + "/partenaire/recherche_type_dip", {type : val}, function(data) {
  	$("#aff_typ").html(data);
  }); 
}

function addCvmapPart(id,adr)
{
  $.post( adr + "/portail/info_bulle_partenaire", {id:id}, function(data) {
  	$("#"+id).html(data);
  });
}

function delCvmapPart(id,adr)
{
  $.post( adr + "/portail/info_bulle_partenaire", {id:id, action:"del"}, function(data) {
  	$("#"+id).html(data);
  });
}

function addCvmapFav(id,adr)
{
  $.post( adr + "/portail/info_bulle", {id:id}, function(data) {
  	$("#"+id).html(data);
  });
}

function delCvmapFav(id,adr)
{
  $.post( adr + "/portail/info_bulle", {id:id, action:"del"}, function(data) {
  	$("#"+id).html(data);
  });
}

function verif_edit_cv(form_id, id, adr, type)
{
	$("#result_edit_cv_"+id).slideUp("slow");
		var intitule = $("#name_"+id).val();
		var contenu = tinyMCE.get("desc_"+id).getContent();
		
		if (intitule.length > 0)
		{
			$.post( adr + "/cvmap/cvnum-update", { id:id, intitule:intitule, contenu:contenu}, function(data) {
				$("#result_edit_cv_"+id).html(data);
				$("#result_edit_cv_"+id).slideDown("slow");
				setTimeout("$(\"#result_edit_cv_\"+"+id+").slideUp(\"slow\");",5000);
				}
			);
		}
		else
			alert("Veuillez nommer le CV.");
}

function verif_edit_commentaire(form_id, id, adr, type)
{
	var tab_connaissance = new Array();
	var tab_nouveau = new Array();
	var tab = $(".connaissances_" + id);
	var tmp;
	var nb_add;
	var nouveau;
	var name;
	var checkbox;
	tab.each(function() {
	checkbox = $(this).parent().children("input[@type=checkbox]:checked").val();
	if (checkbox != null)
	{
		id_conn = $(this).val();
		tmp = $("#niveau_list_" + id + "_" + id_conn).val();
		if (tmp == null)
		{
			nb_add = $(this).parent().children("input[@name=nb]").val();
			tmp = $("#niveau_add_" + id + "_" + nb_add).val();
				
			nouveau = $(this).parent().children("input[@name=id]").val();
			if (nouveau == '')
			{
				if (tab_connaissance[0] == null)
					tab_connaissance[0] = new Array();
				tab_connaissance[0][nb_add]=tmp;
				name = $(this).parent().children("input[@type=checkbox]:checked").val();
				tab_nouveau[nb_add] = name;
			}
			else
				tab_connaissance[id_conn]=tmp;
		}
		else
			tab_connaissance[id_conn]=tmp;
	}
	});
	
//	$("p[@name=save_" + id + "]").slideUp();
//	$("p[@name=save_" + id + "]").html("");
	
	if (type == "formation")
	{
		$("#result_edit_"+id).slideUp("slow");
		var modid = $("#modid_"+id+" :selected").val();
		var entree_mois = $("#entree_mois_"+id+" :selected").val();
		var entree_annee = $("#entree_annee_"+id+" :selected").val();
		var sortie_mois = $("#sortie_mois_"+id+" :selected").val();
		var sortie_annee = $("#sortie_annee_"+id+" :selected").val();
		var statut_formation = $("input[@name=statutformation_"+ id +"][@checked]").val();
		// var desc = tinyMCE.get("desc_"+id).getContent();
		var desc = $("#desc_"+id).val();
		// var projet_perso = tinyMCE.get("projet_perso_"+id).getContent();
		var projet_perso = $("#projet_perso_"+id).val();
		// var comment_stage = tinyMCE.get("comment_stage_"+id).getContent();
		var comment_stage = $("#comment_stage_"+id).val();
		
		$.post( adr + "/cvmap/edit_etape", { id:id, modid:modid, entree_mois:entree_mois, entree_annee:entree_annee, sortie_mois:sortie_mois, sortie_annee:sortie_annee, statut_formation:statut_formation, type:type, desc:desc, projet_perso:projet_perso, comment_stage:comment_stage, "tab_conn[]":tab_connaissance, "tab_name[]":tab_nouveau}, function(data) {
				$("#result_edit_"+id).html("<p id=error>" + data + "</p>");
				$("#result_edit_"+id).slideDown("slow");
				setTimeout("$(\"#result_edit_\"+"+id+").slideUp(\"slow\");",5000);
			}
		);
	}
	if (type == "experience")
	{
		$("#result_edit_exp_"+id).slideUp("slow");
		var poste = $("#poste_"+id).val();
		var statut_pro = $("#statut_pro_"+id+" :selected").val();
		var entree_mois = $("#entree_mois_"+id+" :selected").val();
		var entree_annee = $("#entree_annee_"+id+" :selected").val();
		var sortie_mois = $("#sortie_mois_"+id+" :selected").val();
		var sortie_annee = $("#sortie_annee_"+id+" :selected").val();
		var statut_experience = $("input[@name=statutexperience_"+ id +"][@checked]").val();
//		var desc = tinyMCE.get("desc_"+id).getContent();
		var desc = $("#desc_"+id).val();
//		var projet_perso = tinyMCE.get("projet_perso_"+id).getContent();
		var projet_perso = $("#projet_perso_"+id).val();
//		var comment_formation = tinyMCE.get("comment_formation_"+id).getContent();
		var comment_formation = $("#comment_formation_"+id).val();
	
		$.post( adr + "/cvmap/edit_etape", { id:id, statut_pro:statut_pro, entree_mois:entree_mois, entree_annee:entree_annee, sortie_mois:sortie_mois, sortie_annee:sortie_annee, statut_experience:statut_experience, poste:poste, type:type, desc:desc, projet_perso:projet_perso, comment_formation:comment_formation, "tab_conn[]":tab_connaissance, "tab_name[]":tab_nouveau}, function(data) {
				$("#result_edit_exp_"+id).html("<p id=error>" + data + "</p>");
				$("#result_edit_exp_"+id).slideDown("slow");
				setTimeout("$(\"#result_edit_exp_\"+"+id+").slideUp(\"slow\");",5000);
			}
		);
	}
	if (type == "activite")
	{
		$("#result_edit_act_"+id).slideUp("slow");
		var name = $("#name_"+id).val();
		var entree_mois = $("#entree_mois_"+id+" :selected").val();
		var entree_annee = $("#entree_annee_"+id+" :selected").val();
		var sortie_mois = $("#sortie_mois_"+id+" :selected").val();
		var sortie_annee = $("#sortie_annee_"+id+" :selected").val();
		var statut_formation = $("input[@name=statutformation_"+ id +"][@checked]").val();
	//	var desc = tinyMCE.get("desc_"+id).getContent();
		var desc = $("#desc_"+id).val();
	//	var projet_perso = tinyMCE.get("projet_perso_"+id).getContent();
		var projet_perso = $("#projet_perso_"+id).val();
		
		$.post( adr + "/cvmap/edit_etape", { id:id, name:name, entree_mois:entree_mois, entree_annee:entree_annee, sortie_mois:sortie_mois, sortie_annee:sortie_annee, statut_formation:statut_formation, type:type, desc:desc, projet_perso:projet_perso, "tab_conn[]":tab_connaissance, "tab_name[]":tab_nouveau}, function(data) {
				$("#result_edit_act_"+id).html("<p id=error>" + data + "</p>");
				$("#result_edit_act_"+id).slideDown("slow");
				setTimeout("$(\"#result_edit_act_\"+"+id+").slideUp(\"slow\");",5000);
			}
		);
	}
}

function ChangeAutorisation(champs, id, adr)
{
	$.post(adr + "/cvmap/change_autorisation", { champs:champs }, function(data) {
		$("#"+id).attr("src", data);
	});
}

function ChangeAutorisationID(champs,table, id, value_champs ,adr)
{
	$.post(adr + "/cvmap/change_autorisation", { champs:champs, table:table, value_champs:value_champs }, function(data) {
		$("#"+id).attr("src", data);
	});
}

function MouseCadenas(id, width)
{
	$('#'+id).attr('width', width);
}

function AccepterDemande(id, div, adr)
{
	$.post(adr + "/cvmap/demande_action/accepter", { id:id }, function(data) {
		$("#"+div).html(data);
	});
}

function RefuserDemande(id, div, adr)
{
	$.post(adr + "/cvmap/demande_action/refuser", { id:id }, function(data) {
		$("#"+div).html(data);
	});
}

function ChangeDeploy(id, media_path)
{
	var src = $('#'+id).attr('src');
	if (src == media_path+'/moins.gif')
		src = media_path+'/plus.gif';
	else
		src = media_path+'/moins.gif';
	$('#'+id).attr('src', src);
}

function SetDeploy(aclass, media_path)
{
	$('.'+aclass).attr('src', media_path+'/plus.gif');
}

function add_connaissance_etape(id_efo, input_change, input_nb_add, media_path)
{
	var change = $('#'+input_change).val();
	var nb_add = $('#'+input_nb_add).val();
	var id = '';
	var id_val = 0;
	if ($('#connaissance_value_'+id_efo).val() == $('#input_search_'+id_efo).val())
	{
		id = $('#connaissance_id_'+id_efo).val();
		id_val = id;
	}
	if (change == 1)
	{
		$('#list_connaissance_'+id_efo).append('<li style=\"list-style-type:none;\"><input type=hidden class=\"connaissances_' + id_efo + '\" name=\"connaissances_id['+ id_efo +'][0][' + id + ']\" value=\"' + id_val + '\"><input type=checkbox checked name=\"connaissances['+ id_efo +'][0][' + id + ']\" value=\"' + $('#input_search_'+id_efo).val() + '\"> ' + $('#input_search_'+id_efo).val() + ' <img id=\"star1_add_' + id_efo + '_' + nb_add + '\" src=\"' + media_path + '/star_grey.gif\" onclick=\"clickStar(\'add_' + id_efo + '_' + nb_add + '\', 1)\" style=\"cursor:pointer;\" /><img id=\"star2_add_' + id_efo + '_' + nb_add + '\" src=\"' + media_path + '/star_grey.gif\" onclick=\"clickStar(\'add_' + id_efo + '_' + nb_add + '\', 2)\" style=\"cursor:pointer;\"/><img id=\"star3_add_' + id_efo + '_' + nb_add + '\" src=\"' + media_path + '/star_grey.gif\" onclick=\"clickStar(\'add_' + id_efo + '_' + nb_add + '\', 3)\" style=\"cursor:pointer;\"/><input type=hidden value=\"0\" id=\"niveau_add_' + id_efo + '_' + nb_add + '\" name=\"niveau['+ id_efo +'][0][' + id + ']\"/><input type=hidden value=\"' + nb_add + '\" name=\"nb\"/><input type=hidden name=\"id\" value=\"' + id + '\"/></li>');
	}
	change = 0;
	nb_add++;
	$('#'+input_change).val('0');
	$('#'+input_nb_add).val(nb_add);
}

function ShowCVMap(id_user, id_div, adr)
{
	$.post(adr + "/cvmap/object", { id_user:id_user }, function(data) {
		$("#"+id_div).html('');
		$("#"+id_div).html(data);
		$("#"+id_div).slideDown();
	});
}

function ChangeMenuStatus(class_menu, id_div, adr)
{
	// $('#menu_boite').slideToggle();
	var display_div = $('#'+id_div).css('display');
	/* Affiché => Caché */
	if (display_div != "none") 
	{
		$('#'+id_div).slideUp("slow",function(){
   		$('.'+class_menu).parent().css("background", "transparent url(" + adr + "/colonne_gauche_la_cite/menu1.png) no-repeat scroll left top");
 		});
		
	}
	else 
	{
	// Caché => Affiché
		$('#'+id_div).slideDown("slow");
		$('.'+class_menu).parent().css("background", "transparent url(" + adr + "/colonne_gauche_la_cite/menu_open.png) no-repeat scroll left top");
	}
}

function ChangeDeploy2(object, div_id, adr)
{
	var display_div = $('#'+div_id).css('display');
	/* Affiché => Caché */
	if (display_div != "none")
	{
		$('#'+div_id).slideUp(function(){
   		object.children(".subtitle2").css("background", "transparent url(" + adr + "/new_content_la_cite/sub_title2.png) no-repeat scroll left top");
		});
		
	}
	else
	{
		$('#'+div_id).slideDown();
		object.children(".subtitle2").css("background", "transparent url(" + adr + "/new_content_la_cite/sub_title2_open.png) no-repeat scroll left top");
	}
}

function GetInfoEcole(id, adr)
{
	$.post(adr + "/portail/info_ecole", { id:id }, function(data) {
		var obj = eval('(' + data + ')');
		$("#partenaire_adresse").val(obj.adresse);
		$("#partenaire_ville").val(obj.ville);
		$("#partenaire_cp").val(obj.cp);
		$("#partenaire_pays").val(obj.pays);
		$("#partenaire_url").val(obj.url);
	});
}
