//JavaScript Document for Quelle
//Version : 0.1
//Authors : François OLIVIER

var NOM_DIV_MSG = "divMessage";
var NOM_DIV_BOUTON = "divBouton";

/* Fonction : "switch" entre 2 div */
function switchDiv(idDiv2Hide, idDiv2Show) {
	$("." + idDiv2Hide).hide();
	$("." + idDiv2Show).show();
}
/* /Fonction */

/* Fonction : "switch" automatique entre 2 div */
function switchDivAuto() {
	switchDiv(NOM_DIV_MSG, NOM_DIV_BOUTON);
	setModifAdresse();
}
/* /Fonction */

/**
 * Pour les contactes chargment d'un theme
 */
function contactChargementTheme(nameId){
	
	var id = nameId.substring(6,9);
	$("#"+id).height=950;
	$("#"+id).load("/VAD/ContactTheme?page=ssTheme&themeId="+id,function(data){
		$("#ssThemeAccordion_"+id).accordion({
			active : false,
			fillSpace: true,
			collapsible: true,
			change: function(event, ui){
				if($(ui.newHeader).html() != null){
					contactChargementSousTheme(id,$(ui.newHeader).children(".sousTheme").attr("id"));
				}
			}
		});
		
		//contactChargementSousTheme(id,$("#"+id+" .sousTheme:first").attr("id"));
	});
	$("#"+id).css("height",657);
	
}

function contactChargementSousTheme(theme,sousTheme){
	var id = sousTheme.substring(8,11);
	
	$("#sousTheme_"+id+"_"+theme).load("/VAD/ContactTheme?page=rensComp&themeId="+theme+"&ssThemeId="+id,function(){
		
		$.datepicker.setDefaults($.datepicker.regional['fr']);
		
		$(".date").datepicker({
			dateFormat : 'dd/mm/y',
			changeMonth : true,
			changeYear : true
		});
		
	});
	
}

function toggle_reassurance(inf)
{
 if($("#contactMenu").is(':visible')){
	 $("#contactMenu").slideUp('slow');	
 }else{
	 $("#reassurance1").slideUp('slow');
	 $("#reassurance2").slideUp('slow');
	 $("#reassurance3").slideUp('slow');
	 $("#reassurance4").slideUp('slow');
 }
 if(inf>0){
	 $("#reassurance" + inf).slideDown('slow');
 }
 else
	 $("#contactMenu").slideDown('slow');
}

/**
 * Fonction de chargement du suivi des commandes
 */
function clientChargementSuivitCommande(){
	$(".bout_chargement_suivi_cmd").show();	
	$("#contenu_espace1").load("/VAD/SuiviCommandeServlet", 
			
		function(){
			$("#client_derniere_commande").html($("#client_derniere_commande_result").html());
			$(".bout_chargement_suivi_cmd").hide();
		}
	
	);
}

/**
 * Affichage du formuamalaire de mmodification d'une adresse
 */
function clientAffModif(varIdAdresse,creation,principale,niveau_oper){
	
	$("#cp").removeClass("code_postal");
	$("#cp").removeClass("code_postal_non_dom");
	$("#cp").removeClass("code_postal_dom");
	
	
	if(principale){
		$("#principaleOui").val("1");
		
		$("#cp").addClass("code_postal");
		
	}else{
		$("#principaleOui").val("0");
		
		if(niveau_oper=="O"){
			$("#cp").addClass("code_postal_dom");
			
		}else{
			$("#cp").addClass("code_postal_non_dom");
			
		}
	}
	
	if(principale && creation){
		
		$("#nom_a").attr("readOnly","readonly");
		$("#prenom_a").attr("readOnly","readonly");
		$(".creation_adresse").show();
		$(".modification_adresse").hide();
		
		$("#liste_adresse").fadeOut("normal",function(){
			$("#adresses_modif").fadeIn("normal");
		});
		$('#mradio').attr('disabled','disabled');
		$('#mmeradio').attr('disabled','disabled');
		$('#mlleradio').attr('disabled','disabled');
		
	}else{
		$('#mradio').removeAttr('disabled');
		$('#mmeradio').removeAttr('disabled');
		$('#mlleradio').removeAttr('disabled');
		$.get("/VAD/InfoAdresse",
			{adresseId : varIdAdresse},
			function(data){
				$("#adresseId").val(varIdAdresse);
				
				
				if(creation)		{
					$(".creation_adresse").show();
					$(".modification_adresse").hide();
				}else{
					$(".creation_adresse").hide();
					$(".modification_adresse").show();
				}
				
				if(principale ){
					$(".adresse_secondaire").hide();
				}else{
					$(".adresse_secondaire").show();
					
				}
				traitementAjaxResult(data);
				$("#liste_adresse").fadeOut("normal",function(){
					$("#adresses_modif").fadeIn("normal");
				});
			}
		);
	}
	
}

/**
 * Affichage du formulaire des information des points relais
 */
function clientAffPointRelais(){
	$("#liste_adresse").fadeOut("normal",function(){
		$("#affiche_point_relais").fadeIn("normal");
		$("#liste_adresse").hide();
	});
}

/**
 * Affichage du formulaire de modification d'un point relais
 * depuis l'affichage des informations d'un point relais
 */
function clientAffModifPointRelais(){
	$("#affiche_point_relais").fadeOut("normal",function(){
		$("#modif_point_relais").fadeIn("normal");
		$("#affiche_point_relais").hide();
	});
}

/**
 * Affichage du fomulaire de modification d'un point relais
 * depuis l'affichage de la liste des adresses
 */
function clientAffModifPointRelaisBis(){
	$("#liste_adresse").fadeOut("normal",function(){
		$("#modif_point_relais").fadeIn("normal");
		$("#liste_adresse").hide();
	});
}
	
/**
 * Fonction de retour de l'affichage du carnet d'adresse
 * @param refresh boolean si l'on doit rafraichir la page ou non 
 * @param form Formulaire depuis lequel on fait le retour
 */

function clientRetourListAdresse(refresh,form){
	// TODO d�beuguer le fede out qui ne fonctionne pas
	if(refresh){
		$("#contenu_espace2").load("/VAD/CarnetAdresse",function(){
			$("#"+form).fadeOut("normal",function(){
				$("#liste_adresse").fadeIn("normal");
				$("#"+form).hide();
				
			});
		});
		
	}else{
	
		$("#"+form).fadeOut("normal",function(){
			$("#liste_adresse").fadeIn("normal");
			$("#"+form).hide();
			
		});
	}
}

function clientInfoRetourMail(email){
	$("#info_email").fadeOut("normal",function(){
		$("#info_accueil").fadeIn("normal");
		$("#info_email").hide();
		if(email != null){
			$("#menu_info_email").html(email);
			$("#info_affichage_email").html(email);
			
		}
		
	});
}


function clientInfoAffModifEmail(){
	$("#info_accueil").fadeOut("normal",function(){
		$("#info_email").fadeIn("normal");
		$("#info_accueil").hide();
		
	});
	
}


function clientInfoAffModifMdp(){
	$("#info_accueil").fadeOut("normal",function(){
		$("#info_div_mdp").fadeIn("normal");
		$("#info_accueil").hide();
		
	});
	
}

function clientInfoRetourMdp(){
	$("#info_div_mdp").fadeOut("normal",function(){
		$("#info_accueil").fadeIn("normal");
		$("#info_div_mdp").hide();
	});
}



/* Fonction : insère un message dans une div */
function fillDivWithMsg(idDiv, msg) {
	$("." + idDiv).html("<font color=\"red\"><b><center>"+msg+"</center></b></font>");
}
/* /Fonction */

/* Fonction : "switch" entre 2 div */
function addImg2Field(idField, imgContent) {
	if($("#" + idField).next("img"))
		$("#" + idField).next("img").remove();

	$("#" + idField).after(imgContent);
}
/* /Fonction */


function isDate(dateStr) {

if(dateStr == '--')
return true;

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
var matchArray = dateStr.match(datePat); // is the format ok?

if (matchArray == null) {

return false;
}

month = matchArray[1]; // p@rse date into variables
day = matchArray[3];
year = matchArray[5];

if (month < 1 || month > 12) { // check month range

return false;
}

if (day < 1 || day > 31) {

return false;
}

if ((month==4 || month==6 || month==9 || month==11) && day==31) {

return false;
}

if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day > 29 || (day==29 && !isleap)) {

return false;
}
}
return true; // date is valid
}

/* Remplace un caractère par un autre */
function replaceChars(entry, field) {
	out = ";"; // replace this
	add = " "; // with this
	temp = "" + entry; // temporary holder

	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + 
		temp.substring((pos + out.length), temp.length));
	}
	document.getElementById(field).value = temp;
}

/* Fonction : vérification des champs des formulaires */
function verifChamp(idChamp, pathImg) {
	
	$("#" + idChamp).attr("value",($("#" + idChamp).val()).replace(/à|á|â|ä|å|ã|Ä|Å|Á|Â|À|Ã/g,"a"));
	$("#" + idChamp).attr("value",($("#" + idChamp).val()).replace(/é|è|ê|ë|É|Ê|Ë|È/g,"e"));
	$("#" + idChamp).attr("value",($("#" + idChamp).val()).replace(/ù|ü|û|ú|Ü|Ú|Û|Ù/g,"u"));
	$("#" + idChamp).attr("value",($("#" + idChamp).val()).replace(/ô|ö|ò|ó|õ|Ö|Ø|Ó|Ô|Ò|Õ/g,"o"));
	$("#" + idChamp).attr("value",($("#" + idChamp).val()).replace(/î|ï|ì|í|Î|Ï|Ì/g,"i"));
	$("#" + idChamp).attr("value",($("#" + idChamp).val()).replace(/ç|Ç/g,"c"));
	$("#" + idChamp).attr("value",($("#" + idChamp).val()).replace(/ñ|Ñ/g,"n"));
	
	if (idChamp=="new_email" || idChamp=="email_client_c")
		$("#" + idChamp).attr("value",($("#" + idChamp).val()).toLowerCase());
	else
		if (idChamp!="mdp" && idChamp!="old_mdp" && idChamp!="new_mdp" && idChamp!="confirm_mdp" && idChamp!="pass_client" && idChamp!="confirm_pass" && idChamp!="info_mdp" && idChamp!="info_old_mdp" && idChamp!="info_new_mdp" && idChamp!="info_confirm_mdp" && idChamp!="info_pass_client" && idChamp!="info_confirm_pass" && idChamp!="captcha") 
			$("#" + idChamp).attr("value",($("#" + idChamp).val()).toUpperCase());

	switchDiv(NOM_DIV_MSG, NOM_DIV_BOUTON);
	setModifAdresse();
	var contenu_OK = "<img src=\""+pathImg+"icon_ok.gif"+"\" class=\"droite\" />";
	var contenu_KO = "<img src=\""+pathImg+"icon_ko.gif"+"\" class=\"droite\" />";

	if(idChamp=="nom_client" || idChamp=="prenom_client" || idChamp=="nom_client_c" || idChamp=="nom_a" || idChamp=="prenom_a") {
		
		if($("#" + idChamp).val().indexOf(';')>=0)
			replaceChars(document.getElementById(idChamp).value, idChamp);
		
		// CBL : Ajout RDG : Le nom doit comporter au minimum 2 caractères
		if( isStandardChaine($("#" + idChamp).val() && $("#" + idChamp).val().length >= 2) ) 
			addImg2Field(idChamp, contenu_OK);
		else	
			addImg2Field(idChamp, contenu_KO);
	}
	
	else if(idChamp=="jj_naissance" || idChamp=="mm_naissance" || idChamp=="aaaa_naissance") {
		var date_ok = true;

		if(isEmpty($("#jj_naissance").val()) && isEmpty($("#mm_naissance").val()) && isEmpty($("#aaaa_naissance").val())){
			date_ok = true;
		}
		else{
		
		if(isDate($("#mm_naissance").val() + '-' + $("#jj_naissance").val() + '-' + $("#aaaa_naissance").val()))
				date_ok = true;
		else
				date_ok = false;

			if( isEmpty($("#jj_naissance").val()) ) 
				date_ok = false;
	
			if( isEmpty($("#mm_naissance").val()) )
				date_ok = false;
	
			if( isEmpty($("#aaaa_naissance").val()) )
				date_ok = false;

		}
			
		if( date_ok )
			addImg2Field($("#aaaa_naissance").attr("id"), contenu_OK);
		else	
			// TODO : afficher le message d'erreur quand pas ko
			addImg2Field($("#aaaa_naissance").attr("id"), contenu_KO);
	}
	
	else if(idChamp=="info_jj_naissance" || idChamp=="info_mm_naissance" || idChamp=="info_aaaa_naissance") {
		var date_ok = true;

		if(isEmpty($("#info_jj_naissance").val()) && isEmpty($("#info_mm_naissance").val()) && isEmpty($("#info_aaaa_naissance").val())){
			date_ok = true;
		}
		else{
		
		if(isDate($("#info_mm_naissance").val() + '-' + $("#info_jj_naissance").val() + '-' + $("#info_aaaa_naissance").val()))
				date_ok = true;
		else
				date_ok = false;
		
			if( isEmpty($("#info_jj_naissance").val()) ) 
				date_ok = false;
	
			if( isEmpty($("#info_mm_naissance").val()) )
				date_ok = false;
	
			if( isEmpty($("#info_aaaa_naissance").val()) )
				date_ok = false;
	
		}
			
		if( date_ok )
			addImg2Field($("#info_aaaa_naissance").attr("id"), contenu_OK);
		else	
			// TODO : afficher le message d'erreur quand pas ko
			addImg2Field($("#info_aaaa_naissance").attr("id"), contenu_KO);
	}
	
	else if (idChamp=="new_email" || idChamp=="email_client_c") {
		if( isStandardEmail($("#" + idChamp).val()) ) {
			addImg2Field(idChamp, contenu_OK);
			Ajax_Call("/VAD/NomDomain?champ="+idChamp+"&email="+$("#" + idChamp).val());
		}else	
			// TODO : afficher le message d'erreur quand pas ko
			addImg2Field(idChamp, contenu_KO);
	}
	
	else if (idChamp=="mdp" || idChamp=="old_mdp" || idChamp=="new_mdp" || idChamp=="confirm_mdp" || idChamp=="pass_client" || idChamp=="confirm_pass") {
		var exp = new RegExp("^([a-zA-Z0-9])*$","g");
		if(exp.test($("#" + idChamp).val())){
			if( hasTheGoodSize($("#" + idChamp).val(), 6) ){ 
				addImg2Field(idChamp, contenu_OK);
			}else{	
				// 	TODO : afficher le message d'erreur quand pas ko
				addImg2Field(idChamp, contenu_KO);
			}
		}else{	
			// TODO : afficher le message d'erreur quand pas ko
			addImg2Field(idChamp, contenu_KO);
		}
		
		if(idChamp == 'confirm_pass')
		{
		
		if(document.getElementById('confirm_pass').value == document.getElementById('pass_client').value)
		{
		if( hasTheGoodSize($("#" + idChamp).val(), 6) ){ 
				addImg2Field('confirm_pass', contenu_OK);
				
			}else{	
				// 	TODO : afficher le message d'erreur quand pas ko
				addImg2Field('confirm_pass', contenu_KO);
			}
		}
		else
		{
		addImg2Field(idChamp, contenu_KO);
		}
		
		}
		
	}
	
	else if (idChamp=="info_mdp" || idChamp=="info_old_mdp" || idChamp=="info_new_mdp" || idChamp=="info_confirm_mdp" || idChamp=="info_pass_client" || idChamp=="info_confirm_pass") {
		
		var exp = new RegExp("^([a-zA-Z0-9])*$","g");
		
		if(exp.test($("#" + idChamp).val())){
			if( hasTheGoodSize($("#" + idChamp).val(), 6) ){ 
				addImg2Field(idChamp, contenu_OK);
			}else{	
				// 	TODO : afficher le message d'erreur quand pas ko
				addImg2Field(idChamp, contenu_KO);
			}
		}else{	
			// TODO : afficher le message d'erreur quand pas ko
			addImg2Field(idChamp, contenu_KO);
		}
		
		if(idChamp == 'info_confirm_mdp')
		{
		if(document.getElementById('info_confirm_mdp').value == document.getElementById('info_new_mdp').value)
		{
		if( hasTheGoodSize($("#" + idChamp).val(), 6) ){ 
				addImg2Field('info_confirm_mdp', contenu_OK);
				
			}else{	
				// 	TODO : afficher le message d'erreur quand pas ko
				addImg2Field('info_confirm_mdp', contenu_KO);
				
			}
		}
		else
		{
			addImg2Field(idChamp, contenu_KO);
		}
		}
		
	}
	
	else if(idChamp=="captcha" || idChamp=="libelle_a" || idChamp=="ville") {
		if( isEmpty($("#" + idChamp).val()) ) {
			// TODO : afficher le message d'erreur quand pas ko
			addImg2Field(idChamp, contenu_KO);
		}
		else{
			addImg2Field(idChamp, contenu_OK);
		}
	}
	
	else if(idChamp=="adresse1") {
		if( isEmpty($("#" + idChamp).val()) ) {
			addImg2Field(idChamp, contenu_KO);
		}
		else{
			addImg2Field(idChamp, contenu_OK);
		}
		if($("#" + idChamp).val().indexOf(';')>=0)
			replaceChars(document.getElementById("adresse1").value, "adresse1");
	}
	
	else if(idChamp=="tel") {
		if( isStandardTel($("#" + idChamp).val()) ) 
			// TODO : afficher le message d'erreur quand pas ko
			addImg2Field(idChamp, contenu_OK);
		else	
			addImg2Field(idChamp, contenu_KO);
	}
	
	else if(idChamp=="mobile") {
		if( isStandardMobile($("#" + idChamp).val()) ) 
			// TODO : afficher le message d'erreur quand pas ko
			addImg2Field(idChamp, contenu_OK);
		else	
			addImg2Field(idChamp, contenu_KO);
	}
	
	else if(idChamp=="cp") {
		var expCp = new RegExp("^([0-9][0-9][0-9][0-9][0-9])","g");
		if(expCp.test($("#" + idChamp).val()))
			addImg2Field(idChamp, contenu_OK);
		else	
			addImg2Field(idChamp, contenu_KO);
	}

	// CBL Ajout des nouvelles RDG sur les noms et prénoms
	/* Permet de récupérer la taille du champ nom et de modifier
	 * la taille maximale du champ prénom en fonction du nom
	 * La totalité de nom + prénom doit faire 31 caractères au total */
	if(idChamp=="nom_client_c" || idChamp=="prenom_client") {
		var nom = $("#nom_client_c").val(); 
		var tailleNom = nom.length;
		var maxPrenom = 0;
		if (tailleNom < 31) {
			// calcul de la taille maximale pour le champ prénom
			maxPrenom = 31 - tailleNom;
			// Troncature du prénom lors de la saisie
			document.getElementById("prenom_client").value = document.getElementById("prenom_client").value.substring(0, maxPrenom);
		} else if (tailleNom > 31) {
			// Le nom seul est trop grand pour le champ : on le tronque sur 31 caractères
			document.getElementById("nom_client_c").value = document.getElementById("nom_client_c").value.substring(0, 31);
		} else {
			// le prenom ne peut etre saisi car le nom fait déjà 31 caractères
			document.getElementById("prenom_client").maxlength = 0;
			document.getElementById("prenom_client").value = '';
		}
	}
	// Fin CBL Ajout des nouvelles RDG sur les noms et prénoms
}
/* /Fonction */

/* Fonction : teste si une chaine est vide */
function isEmpty(chaine) {
	if( chaine == "" )
		return true;

	return false;
}
/* /Fonction */


function Chr(AsciiNum)
{

	return String.fromCharCode(AsciiNum)

}

/* Fonction : teste si une chaine est de type "alphabétique limitée" (=> quelques caractères supplémentaires acceptés) */
function isStandardChaine(chaine) {
	//exp = "^([a-zA-Zéèêâîëäïüçé])*$";
	
	expAccent = "";
	for(i=192; i<=255; i++)
	{
		expAccent+= Chr(i);
	}
	expAccent+= '-';
	//exp = "^([a-zA-Z "+Chr(224)+ Chr(192)+"ç�é�è�ê�ë�Ê�Ë�î�ï�ì�?�?ò�ô�ö�õóø���Ô�Ö���â�ä�å�Â�Ä�ùûü�ÛÜ������òñ’])*$";
	
	exp = "^([a-zA-Z "+ expAccent +"])*$";
	
	reg = new RegExp(exp);

	if( chaine == "" || (reg.test(chaine)==0) )
		return false;

	return true;
}
/* /Fonction */

/* Fonction : teste si une chaine est de type "email" */
function isStandardEmail(chaine) {
	exp = "^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$";
	reg = new RegExp(exp);

	if( chaine == "" || (reg.test(chaine)==0) )
		return false;

	return true;
}
/* /Fonction */

/* Fonction : teste si une chaine est de type "numéro de téléphone" */
function isStandardTel(chaine) {
	exp = "^0[1-689]([0-9]{2}){4}$";
	reg = new RegExp(exp);
	
	if( chaine != "" && (reg.test(chaine)==0) )
		return false;

	return true;
}
/* /Fonction */

/* Fonction : teste si une chaine est de type "numéro de téléphone mobile" */
function isStandardMobile(chaine) {
	exp = "^06([0-9]{2}){4}$";
	reg = new RegExp(exp);
	
	if( chaine != "" && (reg.test(chaine)==0) )
		return false;

	return true;
}
/* /Fonction */

/* Fonction : teste si une chaine à une taille requiste (taille fournie en entrée */
function hasTheGoodSize(chaine, goodSize) {
	if( chaine == "" || chaine.length<goodSize)
		return false;

	return true;
}
/* /Fonction */

/* Fonction : password */
function password (email)
{

	$.ajax({
		type: "GET",
		url: "/VAD/SendMail?action=2&email="+email,
		
		async: true,
		dataType: "html",
		error:function(msg){},
		success:function(data){
			traitementAjaxResult(data);
			/*lightbox('lb2', email);*/
		}
	});  
}
/* /Fonction */

/* Fonction : creation de compte*/
function creationCompte(){
	expAccent = "";
	
	expAccent+= '-';
	//exp = "^([a-zA-Z "+Chr(224)+ Chr(192)+"ç�é�è�ê�ë�Ê�Ë�î�ï�ì�?�?ò�ô�ö�õóø���Ô�Ö���â�ä�å�Â�Ä�ùûü�ÛÜ������òñ’])*$";
	
	exp = "^([a-zA-Z0-9 "+ expAccent +"])*$";
	var exp = new RegExp(exp);

	var civiliteM=document.getElementById("mradio");
	var civiliteMm=document.getElementById("mmeradio");
	var civiliteMle=document.getElementById("mlleradio");

	var nom=document.getElementById("nom_client_c");
	var prenom=document.getElementById("prenom_client");

	var jour=document.getElementById("jj_naissance");
	var mois=document.getElementById("mm_naissance");
	var annee=document.getElementById("aaaa_naissance");

	var email=document.getElementById("email_client_c");
	var pass=document.getElementById("pass_client");
	var pass_c=document.getElementById("confirm_pass");

	//var captcha=document.getElementById("captcha");
	var type=document.getElementById("type");
	var num_client=document.getElementById("num_client_v");
	
	var adresse1=document.getElementById("adresse1");
	var cp=document.getElementById("cp");
	var ville = $("#ville").val();
	
	var error='';
	var error_email='';

	if(!civiliteM.checked && !civiliteMm.checked && !civiliteMle.checked) error+='Veuillez selectionner une civilite<br />';
	if(nom==null || nom.value=='') error+='Veuillez saisir votre nom<br />';
	// CBL : Ajout RDG : Le nom doit comporter au minimum 2 caractères
	else if (nom.value.length < 2) error+='Le nom doit comporter au minimum 2 caractères<br />';
	// Fin CBL
	else if( ! isStandardChaine(nom.value) ) error+='Le nom saisi n\'est pas correct<br />';
	if(prenom==null || prenom.value=='') error+='Veuillez saisir votre prenom<br />';
	else if( ! isStandardChaine(prenom.value) ) error+='Le prenom saisi n\'est pas correct<br />';
	if((jour==null || mois==null || annee==null) || ((jour.value!='' || mois.value!='' || annee.value!='') && (jour.value=='' || mois.value=='' || annee.value=='')))
	 error+='Veuillez selectionner votre date de naissance<br />';
	else
	if(!isDate($("#mm_naissance").val() + '-' + $("#jj_naissance").val() + '-' + $("#aaaa_naissance").val())) 
	error+='La date de naissance saisie n\'est pas correcte<br />';
	
	if(adresse1==null || adresse1.value=='') error +='Veuillez saisir votre adresse<br />';
	if(adresse1.value.indexOf(';')>=0) error +='Le champs adresse ne doit pas contenir de point-virgule<br />';
	if(cp==null || cp.value=='' || cp.value.length<5) error += 'Le code postal est invalide<br />';
	if(ville==null || ville=='') error += 'Veuillez sélectionner une ville<br />';
	
	if(email==null || email.value=='') error_email+='Veuillez saisir votre email<br />';
	else if( ! isStandardEmail(email.value) ) error_email+='L\'email saisi n\'est pas correct<br />';
	if(pass==null || pass.value=='') error+='Veuillez saisir un mot de passe.<br />'; 
	else{
		if(!exp.test(pass.value)){
			error+='Le mot de passe contient des caractères spéciaux.<br />';
		}else
			if (pass!=null && pass.value.length<6) error+='Le mot de passe n\'est pas assez long.<br />';
	}
	if(pass==null || pass_c==null || pass.value!='' && pass.value!=pass_c.value) error+='Le mot de passe et sa confirmation doivent être identique<br />';
	//if(captcha==null || captcha.value=='') error+='Veuillez copier le texte de l\'image';

	if(error_email!=''){
		fillDivWithMsg(NOM_DIV_MSG, error_email);
		switchDiv(NOM_DIV_BOUTON, NOM_DIV_MSG);
	}else{
		if(error!=''){
			fillDivWithMsg(NOM_DIV_MSG, error);
			switchDiv(NOM_DIV_BOUTON, NOM_DIV_MSG);
		}else{
			if(verif_email(email.value)){
				var civilite = '1';
				if(civiliteMm.checked) civilite='2';
				if(civiliteMle.checked) civilite='3';

//				Ajax_Call("/VAD/CreationCompte?email="+email.value+"&civilite="+civilite+"&jour="+jour.value+"&mois="+mois.value+"&annee="+annee.value+"&nom="+nom.value+"&prenom="+prenom.value+"&pass="+pass.value+"&type="+type.value+"&num_client="+num_client.value+"&passC="+hex_sha1(pass.value)+"&captcha="+captcha.value+"&adresse1="+adresse1.value+"&cp="+cp.value+"&ville="+ville,null);
				Ajax_Call("/VAD/CreationCompte?email="+email.value+"&civilite="+civilite+"&jour="+jour.value+"&mois="+mois.value+"&annee="+annee.value+"&nom="+nom.value+"&prenom="+prenom.value+"&pass="+pass.value+"&type="+type.value+"&num_client="+num_client.value+"&passC="+hex_sha1(pass.value)+"&adresse1="+adresse1.value+"&cp="+cp.value+"&ville="+ville,null);

			}else{
				fillDivWithMsg(NOM_DIV_MSG, "Email incorrect");
				switchDiv(NOM_DIV_BOUTON, NOM_DIV_MSG);
			}
		}
	}
}
/* /Fonction */

/* Fonction : Modification de compte*/
function modificationCompte(type) {
	
	var clientId=document.getElementById("clientId");
	var exp = new RegExp("^([a-zA-Z0-9\-])*$","g");
	
	if(clientId!=null) {
		var error='';
		var civiliteM=document.getElementById("info_mradio");
		var civiliteMm=document.getElementById("info_mmeradio");
		var civiliteMle=document.getElementById("info_mlleradio");

		var nom=document.getElementById("info_nom_client");
		var prenom=document.getElementById("info_prenom_client");

		var jour=document.getElementById("info_jj_naissance");
		var mois=document.getElementById("info_mm_naissance");
		var annee=document.getElementById("info_aaaa_naissance");

		if(type=="id") {
			
			if(!civiliteM.checked && !civiliteMm.checked && !civiliteMle.checked) error+='Veuillez selectionner une civilite<br />';
			if(nom==null || nom.value=='') error+='Veuillez saisir votre nom<br />';
			// CBL : Ajout RDG : Le nom doit comporter au minimum 2 caractères
			else if (nom.value.length < 2) error+='Le nom doit comporter au minimum 2 caractères<br />';
			// Fin CBL
			else if( ! isStandardChaine(nom.value) ) error+='Le nom saisi n\'est pas correct<br />';
			if(prenom==null || prenom.value=='') error+='Veuillez saisir votre prenom<br />';
			else if( ! isStandardChaine(prenom.value) ) error+='Le prenom saisi n\'est pas correct<br />';
			if((jour==null || mois==null || annee==null) || ((jour.value!='' || mois.value!='' || annee.value!='') && (jour.value=='' || mois.value=='' || annee.value==''))) 
			error+='Veuillez selectionner votre date de naissance<br />';
			else
			if(!isDate(mois.value + '-' + jour.value + '-' + annee.value))
			  error+='La date de naissance saisie n\'est pas correcte<br />';

			if(error!=''){
				fillDivWithMsg(NOM_DIV_MSG, error);
				switchDiv(NOM_DIV_BOUTON, NOM_DIV_MSG);
			
			} else {
			
				var civilite = '1';
				if(civiliteMm.checked) civilite='2';
				if(civiliteMle.checked) civilite='3';

				Ajax_Call("/VAD/ModificationCompte?clientId="+clientId.value+"&civilite="+civilite+"&jour="+jour.value+"&mois="+mois.value+"&annee="+annee.value+"&nom="+nom.value+"&prenom="+prenom.value+"&type="+type,null);
			}
		}
		else if(type=="email") {
			var email=document.getElementById("info_new_email");
			var mdp=document.getElementById("info_mdp");

			if(email==null || email.value=='') error+='Veuillez saisir le nouvel email.<br />';
			else if( ! isStandardEmail($("#info_new_email").val()) ) error+='L\'email n\'est pas correct.<br />'; 
			if(mdp==null || mdp.value=='') error+='Veuillez saisir un mot de passe.<br />'; 
			else{
				if(!exp.test(mdp.value)){
					error+='Le mot de passe contient des caractères spéciaux.<br />';
				}else
					if (mdp!=null && mdp.value.length<6) error+='Le mot de passe n\'est pas assez long.<br />';
			}

			if(error!=''){
				fillDivWithMsg(NOM_DIV_MSG, error);
				switchDiv(NOM_DIV_BOUTON, NOM_DIV_MSG);
			} else {
				Ajax_Call("/VAD/ModificationCompte?clientId="+clientId.value+"&email="+email.value+"&mdp="+mdp.value+"&type="+type,null);
			}
		}
		else if(type=="mdp") {
			var old_mdp=document.getElementById("info_old_mdp");
			var new_mdp=document.getElementById("info_new_mdp");
			var confirm_mdp=document.getElementById("info_confirm_mdp");
			if(old_mdp==null || old_mdp.value=='') error+='Veuillez saisir l\'ancien mot de passe.<br />';
			else if (old_mdp!=null && old_mdp.value.length<6) error+='L\'ancien mot de passe n\'est pas assez long.<br />';
			if(new_mdp==null || new_mdp.value=='') error+='Veuillez saisir le nouveau mot de passe.<br />'; 
			else{
				if(!exp.test(new_mdp.value)){
					error+='Le nouveau mot de passe contient des caractères spéciaux.<br />';
				}else
					if (new_mdp!=null && new_mdp.value.length<6) error+='Le nouveau mot de passe n\'est pas assez long.<br />';
			}
			if(confirm_mdp==null || confirm_mdp.value==''){
				error+='Veuillez saisir le mot de passe de confirmation.<br />'; 
			}else{
				if (confirm_mdp!=null && confirm_mdp.value.length<6){
					error+='Le mot de passe de confirmation n\'est pas assez long.<br />';
				}else{
					if(confirm_mdp.value!=new_mdp.value){
						error+='Le mot de passe de confirmation doit être identique au nouveau mot de passe.<br />';
					}
				}
			}

			if(error!=''){
				fillDivWithMsg(NOM_DIV_MSG, error);
				switchDiv(NOM_DIV_BOUTON, NOM_DIV_MSG);
			} else {
				Ajax_Call("/VAD/ModificationCompte?clientId="+clientId.value+"&old_mdp="+old_mdp.value+"&new_mdp="+new_mdp.value+"&confirm_mdp="+confirm_mdp.value+"&new_mdpC="+hex_sha1(new_mdp.value)+"&type="+type,null);
			}
		}
		else if(type=="intAndNews") {
			var radiooui=document.getElementById("radiooui");
			var radiooui2=document.getElementById("radiooui2");
			var totalNews = document.getElementById("totalNews");
			var totalCentreInt = document.getElementById("totalCentreInt");
			var centres = '';

			/* TODO: radio à récupérer dynamiquement (ils sont déjà générés dynamiquement dans la xsl */
			var offres_quelle = (document.getElementById("newsoui_1").checked) ? "OUI" : "NON";
			var offres_partenaires = (document.getElementById("newsoui_2").checked) ? "OUI" : "NON";

			for(i = 1; i<=totalCentreInt.value; i++){
				if(document.getElementById("centre_int_"+i).checked == true)
					centres+='&centre='+(document.getElementById("centre_int_"+i).value);
			}

			Ajax_Call("/VAD/CentreNewsletter?id_client="+clientId.value+"&modifFlag=1"+"&offres_partenaires="+offres_partenaires+"&offres_quelle="+offres_quelle+centres,null);
		}
	}
}
/* /Fonction */

/* Fonction : ajout centre interet et newsletter*/
function saveCentresNewsletter(){
	var clientId = document.getElementById("id_client");
	var offres_partenaires=document.getElementById("radiooui2");
	var offres_quelle=document.getElementById("radiooui");
	var centres = '';

	for(i = 0; i<document.centreI.centreInteret.length; i++){
		if(document.centreI.centreInteret[i].checked == true)
			centres+='&centre='+(document.centreI.centreInteret[i].value);
	}
	offres_quelle = (document.getElementById("radiooui").checked) ? "OUI" : "NON";
	offres_partenaires = (document.getElementById("radiooui2").checked) ? "OUI" : "NON";
	Ajax_Call("/VAD/CentreNewsletter?id_client="+clientId.value+"&offres_partenaires="+offres_partenaires+"&offres_quelle="+offres_quelle+centres,null);
}
/* /Fonction */


/* Fonction : ajout adresse*/
function addAdresse(source){
	var clientId = $("#clientId").val();
	var adresseId = $("#adresseId").val();

	var libelle = $("#libelle_a").val();
	var civiliteM=document.getElementById("mradio");
	var civiliteMm=document.getElementById("mmeradio");
	var civiliteMle=document.getElementById("mlleradio");
	var nom = $("#nom_a").val();
	var prenom = $("#prenom_a").val();
	var adresse1 = $("#adresse1").val();
	var adresse2 = $("#adresse2").val();
	var adresse3  = $("#adresse3").val();
	var complement = $("#info").val();
	var cp = $("#cp").val();
	var ville = $("#ville").val();
	var tel = $("#tel").val();
	var mobile = $("#mobile").val();
	var smsOui = document.getElementById("smsOui");
	var principaleOui = document.getElementById("principaleOui");
	var panierId = 	$("#panierId").val();

	var error='';

	if(libelle==null || libelle=='') error+='Veuillez donner un nom a l\'adresse<br />';

	if(!civiliteM.checked && !civiliteMm.checked && !civiliteMle.checked)
		error+='Veuillez selectionner une civilite<br />';
	if(nom==null || nom=='') 
		error+='Veuillez saisir votre nom<br />';
	// CBL : Ajout RDG : Le nom doit comporter au minimum 2 caractères
	else if (nom.length < 2) 
		error+='Le nom doit comporter au minimum 2 caractères<br />';
	// Fin CBL
	else if( ! isStandardChaine(nom) ) 
		error+='Le nom saisi n\'est pas correct<br />';
	if(prenom==null || prenom=='') 
		error+='Veuillez saisir votre prenom<br />';
	else if( ! isStandardChaine(prenom) ) 
		error+='Le prenom saisi n\'est pas correct<br />';
	if(adresse1==null || adresse1=='') 
		error+='Veuillez saisir votre adresse<br />';
	if(adresse1.indexOf(';')>=0)
		error +='Le champs adresse ne doit pas contenir de point-virgule<br />';
	if(cp==null || cp=='') 
		error+='Veuillez saisir votre code postal<br />';
	if(source!=null && source=='panierM')
		if(cp==null || cp>='97000') 
			error+='Vous devez saisir une adresse en France Métropolitaine.<br />';
	if(source!=null && source=='panierDom')
		if(cp==null || cp<'97000') 
			error+='Vous devez saisir une adresse dans les DOM.<br />';
	if(ville==null || ville=='') 
		error+='Veuillez saisir votre ville<br />';
	if( tel!=null && tel!='' && ! isStandardTel(tel) ) 
		error+='Le téléphone saisi n\'est pas correct, celui-ci doit comporter 10 chiffres.<br />';
	if( mobile!=null && mobile!='' && ! isStandardMobile(mobile) ) 
		error+='Le téléphone mobile saisi n\'est pas correct, celui-ci doit comporter 10 chiffres.';

	var civilite = '1';
	if(civiliteMm.checked) civilite='2';
	if(civiliteMle.checked) civilite='3';

	var telmob='';
	if(mobile!=null) telmob=mobile;
	var sms = '0';
	if(smsOui!=null && smsOui.checked) sms='1';
	if(sms=='1' && (mobile==null || mobile=='')) error+='Veuillez saisir votre numéro de mobile.';
	var principale = '0';
	if($("#principaleOui").val() != null && $("#principaleOui").val()!=""){
		
		principale = $("#principaleOui").val() ;
	}else{
		var principale = '0';
		if(principaleOui==null || principaleOui.checked) principale='1';

	}
	
	
	if(error!=''){
		fillDivWithMsg(NOM_DIV_MSG, error);
		switchDiv(NOM_DIV_BOUTON, NOM_DIV_MSG);
	}else{
		var param="libelle="+libelle;
		param+="&clientId="+clientId;
		param+="&adresseId="+adresseId;
		param+="&civilite="+civilite;
		param+="&nom="+nom;
		param+="&prenom="+prenom;
		param+="&adresse1="+adresse1;
		param+="&adresse2="+adresse2;
		param+="&adresse3="+adresse3;
		param+="&info="+complement;
		param+="&cp="+cp;
		param+="&ville="+ville;
		param+="&tel="+tel;
		param+="&mobile="+telmob;
		param+="&sms="+sms;
		param+="&principale="+principale;

		if(panierId!=null){
			var montantLivClassique = $("input[name=livraison]:checked").val();
			var montantLivComplement = $("input[name=livraison1]:checked").val();
			var modeLiv = $("input[name=modLiv]").val();
			var lieuLiv = $("input[name=lieuLiv]").val();
			var tauxLiv = $("input[name=tauxLiv]").val();
			if(montantLivClassique == undefined){
				montantLivClassique=$("input[name=livraison]").val();
			}
			if(montantLivComplement == undefined) montantLivComplement=0;
			param+="&panierId="+panierId;
			param+="&modeLiv="+modeLiv;
			param+="&lieuLiv="+lieuLiv;
			param+="&montantLivClassique="+montantLivClassique;
			param+="&montantLivComplement="+montantLivComplement;
			param+="&tauxLiv="+tauxLiv;
		}
		if(adresseId== null || adresseId=='' || adresseId=='0'){
			Ajax_Call("/VAD/CreationAdresse?"+param,null);
		}else{
			Ajax_Call("/VAD/UpdateAdresse?"+param,null);
		}
	}
}



/* /Fonction */

/* Fonction : vérification adresse avant suppression*/
function verifSuppression(adresseId){
	Ajax_Call("/VAD/VerificationSuppression?adresseId="+adresseId,null);
}
/* /Fonction */

/* Fonction : vérification adresse avant suppression*/
function suppression(){
	var adresseId = document.getElementById("adresseId_supp");
	Ajax_Call("/VAD/SuppressionAdresse?adresseId="+adresseId.value,null);
}
/* /Fonction */

/* Fonction : ouverture d'une popup pour le suivi des commandes */
function openPopupSuivi(lien) {
	window.open( lien, 'Transporteur', 'menubar=no,scrollbars=yes,resizable=yes,location=no,toolbar=no,width=800,height=600', true );
}
/* /Fonction */

/* Fonction : ouverture d'une popup pour la carte privil�ge */
function openPopupCartePrivilege(lien) {
	window.open( lien, 'Carte_Privilege', 'menubar=no,scrollbars=yes,resizable=yes,location=no,toolbar=no,width=800,height=600', true );
}
/* /Fonction */

/* Fonction : ouverture d'une popup pour la carte privil�ge */
function openPopupStandard(lien) {
	window.open( lien, 'Quelle', 'menubar=no,scrollbars=yes,resizable=yes,location=no,toolbar=no,width=800,height=600', true );
}
/* /Fonction */

/* Fonction : vérifier si un client est identifier ou non*/
function verficationIdentification(){
	Ajax_Call("/VAD/VerificationIdentification",null);
}
/* /Fonction */

/**
 * Validation du formulaire de contact avec le theme et le sous theme
 */
function valideContact(theme,sousTheme){
	
	var nameform = "#contact_"+theme+"_"+sousTheme;
	var rensSuppl = $(nameform+" input[name=rensSuppl]:checked").val();
	var message = $(nameform+" textarea[name=message]").val();
	
	var erreur=false;

	if(!tunnelVerifAllChamp(nameform)){
		erreur=true; 	
	}
	
	if($(nameform+" input[name=rensSuppl]").val()!=undefined && rensSuppl==undefined){
		$(nameform+" input[name=rensSuppl]:first").before("<a class='msgErr'> Veuillez selectionner l\'objet de votre demande <br /></a>");	
		erreur=true;
		
	}
	
	if(!erreur){
		$.post("/VAD/ValidFormContact",
				$(nameform).serialize(),
			function(data){
				lightbox('lb19');
			}
		);
	}
	
	
/*	var tmp_rens=false;
	if(rensSuppl!=null){
		if(document.contact.rensSuppl.length==undefined && document.contact.rensSuppl.checked)
			tmp_rens=true;
		else{
			for (index=0; index < document.contact.rensSuppl.length; index++) {
				if (document.contact.rensSuppl[index].checked) {
					tmp_rens=true;
					break;
				}
			}
		}
		if(!tmp_rens){
			alert('Veuillez selectionner l\'objet de votre demande');
			erreur=true;
			return false;
		}
	}
	if(message==null || message.value==''){
		alert('Veuillez saisir votre message');
		erreur=true;
		return false;
	}

	if(!erreur){
		$(nameform).submit(); // document.contact.submit();
	}*/
}

/* /Fonction */

function getInfoAdresse(){
	var adresseId = document.getElementById("adresseId");
	
	/* si @ principale, #principaleOui="1", sinon "0" => par d�faut il est � "1" */
	if (adresseId.value==$("#id_principale").val()) {
		$("#principaleOui").val("1");
	}
	else {
		$("#principaleOui").val("0");
	}

	Ajax_Call("/VAD/InfoAdresse?adresseId="+adresseId.value,null);
}

/* Fonction : CDGP 3 Clics */
function CDGP3C () {
	$.ajax({
		type: "GET",
		url: "/VAD/CDGPValidation",
		async: true,
		dataType: "html",
		error:function(msg){},
		success:function(data){
			traitementAjaxResult(data);
		}
	});  
}

/**
 * Méthode de validation de la newletter
 */
function CDGP3CValidNewsLetter(){
	var cookie = getJsonCookie("QuelleInfoClient");
	var clientId = cookie.emId;
	var offres_partenaires= $(".auth_creation_espace2 input[name=offres_partenaires]:checked").val();	
	var offres_quelle=$(".auth_creation_espace2 input[name=offres_quelle]:checked").val();
	var centres = '';
	$("#error_offres_partenaires").hide();
	$("#error_offres_quelle").hide();

	if (offres_partenaires == undefined) {
		$("#error_offres_partenaires").show();
	} 
	if (offres_quelle == undefined){
		$("#error_offres_quelle").show();
	} 
	if(offres_partenaires != undefined && offres_quelle != undefined) {
		$(".check").each(function(){
			// Récupération des centres d'intéret
			if($(this).attr("checked")!= undefined && $(this).attr("checked")!=""){
				centres+='&centre='+$(this).val();
			}
		});
		// Soumission du formulaire des centres d'intéret
		$.get("/VAD/CentreNewsletter?src=CDGP&id_client="+clientId+"&offres_partenaires="+offres_partenaires+"&offres_quelle="+offres_quelle+centres,
				function(data){
			traitementAjaxResult(data);
		});
	}
}

/* Fonction : vérification de l'identification du client */
function verifNewsletter(){
	Ajax_Call("/VAD/VerifNewsletterControl",null);
}

//CBL : Fonction pour la validation de la demande de catalogue
function DdeCat () {
	$.ajax({
		type: "GET",
		url: "/VAD/DdeCatValidation",
		async: true,
		dataType: "html",
		error:function(msg){},
		success:function(data){
			traitementAjaxResult(data);
		}
	});  	
}

/* CBL Fonction : modification d'adresse lors de la demande de catalogue */
function ddeCatModifAdresse(){
	var clientId = $("#clientId").val();
	var adresseId = $("#adresseId").val();
	var libelle = $("#libelle_a").val();
	var civiliteM=document.getElementById("mradio");
	var civiliteMm=document.getElementById("mmeradio");
	var civiliteMle=document.getElementById("mlleradio");
	var nom = $("#nom_a").val();
	var prenom = $("#prenom_a").val();
	var adresse1 = $("#adresse1").val();
	var adresse2 = $("#adresse2").val();
	var adresse3  = $("#adresse3").val();
	var complement = $("#info").val();
	var cp = $("#cp").val();
	var ville = $("#ville").val();
	var tel = $("#tel").val();
	var mobile = $("#mobile").val();
	var smsOui = document.getElementById("smsOui");
	var principaleOui = $("#principaleOui").val();

	var error = '';

	if(!civiliteM.checked && !civiliteMm.checked && !civiliteMle.checked)
		error += 'Veuillez selectionner une civilite<br />';
	if(nom == null || nom == '') 
		error+='Veuillez saisir votre nom<br />';
	else if (nom.length < 2) 
		error+='Le nom doit comporter au minimum 2 caractères<br />';
	else if( !isStandardChaine(nom) ) 
		error += 'Le nom saisi n\'est pas correct<br />';
	if(prenom == null || prenom == '') 
		error += 'Veuillez saisir votre prenom<br />';
	else if( !isStandardChaine(prenom) ) 
		error += 'Le prenom saisi n\'est pas correct<br />';
	if(adresse1 == null || adresse1 == '') 
		error += 'Veuillez saisir votre adresse<br />';
	if(adresse1.indexOf(';') >= 0)
		error += 'Le champs adresse ne doit pas contenir de point-virgule<br />';
	if(cp == null || cp == '') 
		error += 'Veuillez saisir votre code postal<br />';
	if(ville == null || ville == '') 
		error += 'Veuillez saisir votre ville<br />';
	if (tel != null && tel == 'null') tel = '';
	if (mobile != null && mobile == 'null') mobile = '';
	if( tel != null && tel != '' && !isStandardTel(tel) ) 
		error += 'Le téléphone saisi n\'est pas correct, celui-ci doit comporter 10 chiffres.<br />';
	if( mobile != null && mobile != '' && !isStandardMobile(mobile) ) 
		error += 'Le téléphone mobile saisi n\'est pas correct, celui-ci doit comporter 10 chiffres.';

	var civilite = '1';
	if(civiliteMm.checked) civilite='2';
	if(civiliteMle.checked) civilite='3';

	var sms = '0';
	if(smsOui != null && smsOui.checked) sms = '1';
	
	var telmob='';
	if(mobile!=null) telmob=mobile;
	
	var principale = '0';
	if($("#principaleOui").val() != null && $("#principaleOui").val()!=""){
		principale = $("#principaleOui").val() ;
	} else {
		var principale = '0';
		if(principaleOui==null || principaleOui.checked) principale='1';
	}
	
	if(error!=''){
		fillDivWithMsg(NOM_DIV_MSG, error);
		switchDiv(NOM_DIV_BOUTON, NOM_DIV_MSG);
	}else{
		var param = "libelle=" + libelle;
		param += "&clientId=" + clientId;
		param += "&adresseId=" + adresseId;
		param += "&civilite=" + civilite;
		param += "&nom=" + nom;
		param += "&prenom=" + prenom;
		param += "&adresse1=" + adresse1;
		param += "&adresse2=" + adresse2;
		param += "&adresse3=" + adresse3;
		param += "&info=" + complement;
		param += "&cp=" + cp;
		param += "&ville=" + ville;
		param += "&tel=" + tel;
		param += "&mobile=" + telmob;
		param += "&sms=" + sms;
		param += "&principale=" + principale;
		
		// Appel à la servlet de modification d'adresse
		Ajax_Call("/VAD/UpdateAdresseDdeCat?"+param,null);
	}
}
