catsSelectAdd = function() {
	var ajaxCall = new Ajax.Request(
		"../processor/ajax.php?a=catsSelectAdd",
		{
			method: 'get',
			onSuccess: function(xhr){
            	$('a-cats-div').innerHTML += xhr.responseText;
          	}
		}
	);
};



numsSelectAdd = function(id_pro) {
	/*var ajaxCall = new Ajax.Request(
		"../processor/ajax.php?a=numsSelectAdd&id_pro=" + id_pro,
		{
			method: 'get',
			onSuccess: function(xhr){
            	$('a-nums-div').innerHTML += xhr.responseText;
          	}
		}
	);*/


	var divWrap = document.createElement("div");
	divWrap.setAttribute("style", "margin-bottom: 8px;");

	var inpLabel = document.createElement("input");
	inpLabel.setAttribute("type", "text");
	inpLabel.setAttribute("name", "num_label[]");
	inpLabel.setAttribute("value", "");
	inpLabel.setAttribute("style", "width: 250px;");

	var spacer = document.createTextNode(' : ');

	var inpNumero = document.createElement("input");
	inpNumero.setAttribute("type", "text");
	inpNumero.setAttribute("name", "num_numero[]");
	inpNumero.setAttribute("value", "");
	inpNumero.setAttribute("class", "tiny-input");

	var link = document.createElement("a");
	link.setAttribute("href", "../ihm_ai/professionnels.php?a=delNP&id={$this->id}&id_pro=" + id_pro);

	var linkImg = document.createElement("img");
	linkImg.setAttribute("src", "../img/ico_del.gif");
	linkImg.setAttribute("alt", "Supprimer le numéro");
	linkImg.setAttribute("title", "Supprimer le numéro");
	linkImg.setAttribute("style", "margin-left: 7px; margin-bottom: -3px;");


	//Append
	divWrap.appendChild(inpLabel);
	divWrap.appendChild(spacer);
	divWrap.appendChild(inpNumero);
	link.appendChild(linkImg);
	divWrap.appendChild(link);

	$('a-nums-div').appendChild(divWrap);
};




function removeCatSelect(catSelectId) {
	var cats_div = document.getElementById('a-cats-div');
	var catsSelect = document.getElementById('catSelect_' + catSelectId);
	var catsDelButton = document.getElementById('catDelButton_' + catSelectId);
	cats_div.removeChild(catsSelect);
	cats_div.removeChild(catsDelButton);
};




function moreInfos(id){
	var divMN = document.getElementById('mn_' + id);
	var aML = document.getElementById('ml_' + id);

	if(divMN.style.display == 'none' || divMN.style.display == ''){
		divMN.style.display = 'block';
		aML.innerHTML = 'Masquer';
	}
	else {
		divMN.style.display = 'none';
		aML.innerHTML = 'Plus d\'infos';
	}
};




function getCoordFromNumber(number){
	$.ajax({
   		type: "get",
   		url: "../processor/ajax.php",
   		data: "a=getCoordFromNumber&number=" + number,
   		success: function(msg){
   			var _t = msg.split("__");

   			document.getElementById('nom').value = _t[0];
   			document.getElementById('prenom').value = _t[1];
   			document.getElementById('n_voie').value = _t[2];
   			document.getElementById('rue').value = _t[3];
   			document.getElementById('bp').value = _t[4];
   			document.getElementById('id_ville').value = _t[5];
   		}
 	});
}



function highlightTelOpt(id){
	if(document.getElementById(id).checked === true){
		document.getElementById(id).checked = false;
		document.getElementById("div-" + id).style.backgroundColor = "#eeeeee";
	}
	else {
		document.getElementById(id).checked = true;
		document.getElementById("div-" + id).style.backgroundColor = "#DDEEC2";
	}
}