



function controleTel(numTel){
	var exp = new RegExp("^[\\d-]{10,}$", "ig");
	
	if(exp.test(numTel)==false) {
		return 1;
	}	
	return 0;
}

function trim(string){
	return string.replace(/(^\s*)|(\s*$)/g,'');
} 

function affichesousmenu(id){
	var sousmenu = Dmc_Layer.is_object("sousmenu"+id)
	//document.getElementById("sousmenu"+id)
	if(sousmenu!=false){
		if(sousmenu.style.display=="none"){sousmenu.style.display="block"}else{sousmenu.style.display="none"}
	}
}

	/** Sélectionne automatiquement l'option de la liste 
	 * de la valeur passée en paramètre
	 * @param sel : le select
	 * @param value : la valeur à sélectionner 
	 */
	function selectOption(sel, value){
		if (sel != undefined) {
			for (i=0;i<sel.options.length;i++) { 
		 	 	if (sel.options[i].value==value) { 
					sel.options[i].selected=true;
					break;
		  		}
			}
		} 
	}
/** Renvoie true si le mail est correcte, false sinon
Si le mail est faux une alert est affichée
*/
function isEmailOk( email){
if ( isPlacementOk('@',email))	{
		var domaine = email.substring(email.indexOf('@')+1,email.length);
		if (isPlacementOk('.',domaine))
		{
			var infoPerso = email.substring(0,email.indexOf('@'));
			if (infoPerso.indexOf('.')>-1)
			{
				if (isPlacementOk('.' , infoPerso))
					return true; 
			}
			else
				return true;
		}
	}
	return false;
		
}

/* Utilisée poar isMailOk 
Verifie la présence d'un caractere.Il ne doit ni etre en premiere position ni en derniere*/ 
function isPlacementOk(caract , mot)
{
	var i = mot.indexOf(caract);
	var taille = mot.length;
	
	if (i>0)
	{
		if (mot.charAt(taille-1)!=caract)
			return true;
	}
	return false;
}

/**
 * Ouverture d'une popup sans décoration
 */ 
function openPop(url, nom, largeur, hauteur) {
  newWindow = open(url, nom, "width="+largeur+",height="+hauteur+",toolbar=no,scrollbars=no,resizable=no,titlebar=yes")
  newWindow.moveTo( (parseInt(screen.width)-largeur)/2 ,(parseInt(screen.height)-hauteur)/2 );
  newWindow.focus();
}

/**
 * Ouverture d'une popup avec scroll bars
 */ 
function openPopScroll(url, nom, largeur, hauteur) {
  newWindow = open(url, nom, "width="+largeur+",height="+hauteur+",toolbar=no,scrollbars=yes,resizable=yes,menubar=no,location=no,status=no,titlebar=no");
  //newWindow = open(url, nom, "width="+largeur+",height="+hauteur+",toolbar=no,scrollbars=yes,resizable=yes,titlebar=yes")
  newWindow.moveTo( (parseInt(screen.width)-largeur)/2 ,(parseInt(screen.height)-hauteur)/2 );
  newWindow.focus();
}

/**
 * Ouverture d'une popup avec scroll bars et une barre d'outil
 */ 
function openPopScrollToolbar(url, nom, largeur, hauteur) {
  newWindow = open(url, nom, "width="+largeur+",height="+hauteur+",toolbar=yes,scrollbars=yes,resizable=yes,titlebar=yes")
  newWindow.moveTo( (parseInt(screen.width)-largeur)/2 ,(parseInt(screen.height)-hauteur)/2 );
  newWindow.focus();
}

/**
 * Popups GénieCube
 */ 
function imgPopup(nomPop,img,fond,txt,css){
   imgPop = window.open("",nomPop,"scrollbars=yes,width=700,height=550");
   imgPop.document.write("<html>\n\n");
   imgPop.document.write("<head><title>Apercu d'image</title></head>\n\n");
   imgPop.document.write("<body bgcolor=\""+fond+"\">\n");
   imgPop.document.write("  <table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">\n");
   imgPop.document.write("    <tr><td align=\"center\"><img src=\"ressources/"+img+"\"></td></tr>\n");
   imgPop.document.write("    <tr><td align=\"center\">\n");
   imgPop.document.write("      <table border=\"0\" cellpadding=\"0\" cellspacing=\"2\">\n");
   imgPop.document.write("        <tr><td><span style=\""+css+"\">"+txt+"</span></td></tr>\n");
   imgPop.document.write("      </table>\n");
   imgPop.document.write("    </td></tr>\n");
   imgPop.document.write("  </table>\n");
   imgPop.document.write("</body>\n\n");
   imgPop.document.write("</html>");
}


// fonction modifiée pour prendre en compte la génération des pages dans un sous répertoire
function popup(adr,nompop,larg,haut,res){
  window.open("maroquinerie_valise_bagages_sac.gnc?Destination=affGCAutrePopup&key="+adr,nompop,'width='+larg+',height='+haut+',scrollbars=1,toolbar=0,location=0,status=0,menubar=0,resizable='+res);
}

function is_VariableImg(nom){
	if(typeof(eval("window."+nom))=="object"){
		return eval("window."+nom);
	}
	return false;
}

function moteurrecherche(formu){
  var obj = document.forms[formu];
  obj.submit();
}

function validenewsletter(objetForm){
		
		//test que l'email n'est pas vide
		if(objetForm.email.value==""){
			alertLayer ("Vous devez saisir votre adresse email.", 200, 200);
		return;
		}
		
		// test de la validité de l'email
		if (!isEmailOk(objetForm.email.value)) {
			alertLayer ("L'email que vous avez saisi (\""+objetForm.email.value+"\") n'est pas valide.<br>Veuillez le saisir à nouveau.", 200, 200);
			return;
		}else{	
			objetForm.Destination.value="validNewsLetter";
			objetForm.submit();
		}
		
}


	
/*

function afficheInfosNewsletter(id,posx){
	clearTimeout(timeout);
	var layer = Dmc_Layer.is_object(id);
	Dmc_Layer.set_posx(layer,posx);
	layer.style.display="block"
}

function cacheInfosNewsletter(id){
	appel = "cacheInfosNewsletterImmediat('"+id+"')",
	timeout = setTimeout(appel,250);
}
function cacheInfosNewsletterImmediat(id){
	var layer = Dmc_Layer.is_object(id);
	layer.style.display="none";
}
*/

function getOffsetLeft(elementReference, decalage){
	//alert(document.getElementById(elementReference).offsetLeft);
	return parseInt(document.getElementById(elementReference).offsetLeft) + decalage;
}
//fin fonction valide()
function validerRechercheHome(){
	var objform = document.forms.frecherche;
	var valeurMarque = objform.marque.value;
	
	if(valeurMarque.indexOf("M")!=-1){
		objform.numm.value = valeurMarque.substring(1,valeurMarque.length) ;
		objform.numl.value = "";
	}else if(valeurMarque.indexOf("L")!=-1){
		objform.numl.value = valeurMarque.substring(1,valeurMarque.length);
		objform.numm.value = "";
	}else if(valeurMarque.indexOf("T")!=-1){
		objform.numl.value = "";
		objform.numm.value = "";
	}else{
		objform.numl.value = "";
		objform.numm.value = "";
	}
	
	var valeurrayon =  objform.rayon.value;
	if(valeurrayon.indexOf("R")!=-1){
		objform.numr.value = valeurrayon.substring(1,valeurrayon.length) ;
		objform.numf.value = "";
		objform.numsf.value = "";
	}else if(valeurrayon.indexOf("F")!=-1){
		objform.numf.value = valeurrayon.substring(1,valeurrayon.length);
		objform.numr.value = "";
		objform.numsf.value = "";
	}else if(valeurrayon.indexOf("S")!=-1){
		objform.numr.value = "";
		objform.numf.value = "";
		objform.numsf.value = valeurrayon.substring(1,valeurrayon.length);
	}else{
		objform.numsf.value = "";
		objform.numr.value = "";
		objform.numf.value = "";
	}	
		
	if((objform.texte.value).indexOf("l'aide d'un mot cl")!=-1){
		objform.texte.value="";
	}
	objform.isRechercheAvancee.value = false;
	objform.submit()
}

function validerRechercheAvancee(){
	var objform = document.forms.frecherche;
	objform.isRechercheAvancee.value = true;
	if((objform.texte.value).indexOf("l'aide d'un mot cl")!=-1){
		objform.texte.value="";
	}
	objform.submit()
}

function validerechercheSinple(){
document.forms.formrecherchetext.submit();
}
function affichemenuRayonMarque(nom){
	var menu = Dmc_Layer.is_object(nom)
	if(menu!=false){
		if(menu.style.display=="none"){menu.style.display="block"}else{menu.style.display="none"}
	}
}

function favoris() { 
      if ( navigator.appName != 'Microsoft Internet Explorer' ){ 
          window.sidebar.addPanel("Gsell.fr : Bagage Samsonite, valise, sac a main, sacs, bagages, maroquinerie, Delsey","http://www.gsell.fr/",""); 
      } 
      else { 
          window.external.AddFavorite("http://www.gsell.fr/","Gsell.fr : Bagage Samsonite, valise, sac a main, sacs, bagages, maroquinerie, Delsey"); 
      } 
} 

function initImput(objInput){
	if(objInput.value==""){
		objInput.value=objInput.defaultValue;
	}
}
function fermerElement(nom){
	var menu = Dmc_Layer.is_object(nom)
	if(menu!=false){
		menu.style.display="none";
	}
}
dmcUtils = new Object();
dmcUtils.getBody = function (){
		return (!window.opera && document.compatMode && document.compatMode!="BackCompat") ? document.documentElement:document.body;
};
function getEcranX(){
	
	if (dmcUtils.getBody().clientWidth){
		return parseInt(dmcUtils.getBody().clientWidth);
	}else if (window.innerWidth != null){
		return parseInt(window.innerWidth);
	}
	return (0);
}

function getEcranY(){
	if (window.innerHeight != null){
		return parseInt(window.innerHeight);
	}
	if (dmcUtils.getBody().clientHeight != null){
		return parseInt(dmcUtils.getBody().clientHeight);
	}
	return (0);
}

function setOpacity (objet,valeur) {
if(objet==null || valeur==null){return };
 if(valeur < 0.00001) valeur = 0;
  if(objet.attachEvent){
	objet.style.filter = objet.style.filter.replace(/alpha\([^\)]*\)/gi,'') + 'alpha(opacity='+valeur*100+')';
  }
objet.style["opacity"] = valeur;
};
	
function centreElement(ele){
		
	if(ele){
		var posyy=(dmcUtils.getBody().scrollTop != undefined)?  parseInt(dmcUtils.getBody().scrollTop) : window.pageYOffset;
			var posx=((getEcranX()-parseInt(ele.clientWidth))/2);
			
			var posy=(Number((getEcranY()-parseInt(ele.clientHeight))/2)+posyy);
			ele.style.left=posx+"px";
			ele.style.top=(posy<=0)? "0px" : posy+"px";
		
	}
}
function createLayerChargement(zoneconteneur,couleur,opacite,gif){
		// Attention : l'element zoneconteneur doit être en position:relative ou position:absolute
		var parent = document.getElementById(zoneconteneur);
		var  l = document.getElementById("lchargement")
		if(!l || (l && l.parentNode != parent)){
			
			var lchargement = document.createElement("div");
				lchargement.style.width =parent.clientWidth+"px";
				lchargement.style.height =parent.clientHeight+"px";
				lchargement.id = 'lchargement';
				lchargement.style.position ="absolute";
				lchargement.style.top ="0px";
				lchargement.style.left ="0px";
				parent.appendChild(lchargement);
			var lchargementf = document.createElement("div");
				lchargement.appendChild(lchargementf);
				lchargementf.style.width =parent.clientWidth+"px";
				lchargementf.style.height =parent.clientHeight+"px";
				lchargementf.style.position ="absolute";
				lchargementf.style.top ="0px";
				lchargementf.style.left ="0px";
				lchargementf.style.zIndex=99;
				lchargementf.style.backgroundColor = couleur;
				setOpacity (lchargementf,opacite);
			var lchargementi = document.createElement("img");
				lchargementi.style.position ="absolute";
				lchargementi.style.zIndex=100;
				lchargement.appendChild(lchargementi);
				lchargementi.style.left =(parent.clientWidth/2-39)+"px";
				lchargementi.style.top =(parent.clientHeight/2-42)+"px";
				lchargementi.src = gif;
		}
}

function changeResultats(){
	document.form1.Destination.value = "changeResultats";
	document.form1.submit();
}

function envoyermessage(){
		var objform = document.forms.formmessage;
		// test de la validité de l'email
		if(objform.email.value!=""){
			if (!isEmailOk(objform.email.value)) {
				alertLayer ("L'email que vous avez saisi ("+objform.email.value+") n'est pas valide.<br>Veuillez le saisir à nouveau", null);
				return;
			}
		}
		//test du champs obligatoire
		var oblig = "";
		if (objform.numMotif) {
			if (objform.numMotif.value == "") oblig += "<br> - Motif";	
		}
		if (objform.nom.value=="") oblig += "<br> - Nom";		
		if (objform.email.value=="") oblig += "<br> - E-mail";		
		if (objform.message.value=="") oblig += "<br> - Message";		
		if (oblig==""){
			objform.Destination.value="validNousContacter";
			objform.submit();                                                                                   
		} else {
			oblig = "Vous devez saisir le(s) champ(s) : " + oblig;
			alertLayer (oblig, numRayon);
		}		
}

//fonction spécifique à gsell, utilisant les nouveau layers
function envoyermessageGsell(){
	var objform = document.forms.formmessage;
	// test de la validité de l'email
	if(objform.email.value!=""){
		if (!isEmailOk(objform.email.value)) {
			alertLayer ("L'email que vous avez saisi ("+objform.email.value+") n'est pas valide.<br>Veuillez le saisir à nouveau", null);
			return;
		}
	}
	//test du champs obligatoire
	var oblig = "";
	if (objform.numMotif) {
		if (objform.numMotif.value == "") oblig += "<br> - Motif";	
	}
	if (objform.nom.value=="") oblig += "<br> - Nom";		
	if (objform.email.value=="") oblig += "<br> - E-mail";		
	if (objform.message.value=="") oblig += "<br> - Message";		
	if (oblig==""){
		objform.Destination.value="validNousContacter";
		objform.submit();                                                                                   
	} else {
		oblig = "Vous devez saisir le(s) champ(s) : " + oblig;
		$('contenu_alerte').update(oblig);
		$('layer_alerte').style.display="block";
	}		
}

// debut fonctions page suivre commande
function openColissimo(numero) {
	if (numero == undefined) {
		numero = document.formsuivitcom.numeroColissimo.value;
	}
	if (!testNumero(numero)) return;
		openPopScroll("http://www.coliposte.net/particulier/suivi_particulier.jsp?colispart="+numero,"Colissimo",760,500);
}

function openChronopost() {
	numero = document.formsuivitcom.numeroChronopost.value;
	if (!testNumero(numero)) return;
	openPopScroll("http://www.fr.chronopost.com/web/fr/tracking/suivi_inter.jsp?listeNumeros="+numero,"Chronopost",790,500);
}

function testNumero(numero){
	if (numero.length<13){
		alertLayer ("Vous devez saisir un numéro de colis composé de 13 caractères.", numRayon);
		return false;
	}
	return true;
}

// fin fonctions page suivre commande

function showElement(element){
	document.getElementById(element).style.display="block";	
}

function hideElement(element){
	document.getElementById(element).style.display="none";	
}

// affichage du layer
function initShowLayer(element_survole, calque){
	focusLogin = false;
	var objBouton = $(element_survole);
	Object.extend(objBouton, {timer:null,timeout:1000, bubblingTimer:null, bubblingTime:2000});
	objBouton.stopObserving("mouseover");
	objBouton.stopObserving("mouseout");

	objBouton.observe('mouseover', function(event){
		var layer  = $(calque);
		layer.stopObserving("mouseover");
		layer.stopObserving("mouseout");

		var  objBouton = $(element_survole)
		clearTimeout(objBouton.timer);
		layer.setStyle({display:"block"});

		layer.observe('mouseover', function(event){
			var layer  = $(calque);
			var  objBouton = $(element_survole);
			clearTimeout(objBouton.timer);
			clearTimeout(objBouton.bubblingTimer);
			layer.setStyle({display:"block"});
		}
		);

		layer.observe('mouseout', function(event){

			var  objBouton = $(element_survole);
			clearTimeout(objBouton.timer);

			objBouton.bubblingTimer = setTimeout(function() {
				var layer  = $(calque);
				if(!focusLogin){
					layer.setStyle({display:"none"});
				}
			}, objBouton.bubblingTime);

		}
		);
	})

	objBouton.observe('mouseout', function(event){
		var  objBoutona = $(element_survole)
		objBoutona.timer = setTimeout(function(){
			var layer  = $(calque);
			layer.setStyle({display:"none"});
		},objBoutona.timeout)
	})
}

function valide_login(form){
	
	// test de la validité de l'email
	if ((form.login.value=="")||(form.password.value=="")){
		alertLayer ("Vous devez saisir votre email et votre mot de passe.", null);
		return;
	} else {	
		form.Destination.value="validCompteLogin";
		form.submit();
	}
}

function pwd_oublie_perdu(form){
	
	//test que l'email n'est pas vide
	if(form.login.value==""){
		alertLayer ("Vous devez saisir votre adresse email.");
		return;
	}else if (!isEmailOk(form.login.value)) {
		alertLayer ("L'email que vous avez saisi ("+document.form_compte.login.value+") n'est pas valide.<br/>Veuillez le saisir à nouveau");
		return;
	}else {				
		form.Destination.value="sendPassword";
		form.submit();
	}
}


//fonction adaptée aux nouveaux layers de gsell
function pwd_oublie_perduGsell(form){
	
	//test que l'email n'est pas vide
	if(form.login.value==""){
		$('contenu_alerte').update("Vous devez saisir votre adresse email.");
		$('layer_alerte').style.display="block";
		return;
	}else if (!isEmailOk(form.login.value)) {
		$('contenu_alerte').update("L'email que vous avez saisi ("+document.form_compte.login.value+") n'est pas valide.<br/>Veuillez le saisir à nouveau");
		$('layer_alerte').style.display="block";
		return;
	}else {				
		form.Destination.value="sendPassword";
		form.submit();
	}
}


function sleep(time){
   d=new Date();
   diff=0;
    while(diff < time)
    {
      n=new Date();
      diff=n-d;
     } 
}

function cacher_sous_menus(){
	hideElement('smenu_mode_femme');
	hideElement('smenu_mode_homme');
	hideElement('smenu_mode_junior');
	hideElement('smenu_bagage');
	hideElement('smenu_business');	
}

function desactiver_survols(){
	document.getElementById('lien_femme').className='lien_femme';
	document.getElementById('lien_homme').className='lien_homme';
	document.getElementById('lien_junior').className='lien_junior';
	document.getElementById('lien_bagage').className='lien_bagage';
	document.getElementById('lien_business').className='lien_business';
}

/*-------------------- La navigation entre les onglets -----------------------*/

function activer_tab(id_tab, id_lien){
	Effect.toggle(id_tab,'appear');
	activer_lien_tab(id_lien);
}

function desactiver_tabs(){
	hideElement('prod_similaire');
	hideElement('offre');
	hideElement('service');
	hideElement('conseil');	
}

function activer_lien_tab(id_lien){
	desactiver_liens_tabs();
	$(id_lien).className = 'ongle_selected_'+id_lien;
}

function desactiver_liens_tabs(){
	$('lien_similaire').className = 'ongle';
	$('lien_offre').className = 'ongle';
	$('lien_service').className = 'ongle';
	$('lien_conseil').className = 'ongle';
}

function switch_tab(id_tab, class_lien, id_lien){
	if(class_lien != "ongle_selected_"+id_lien){
		desactiver_tabs();
		activer_tab(id_tab, id_lien);
		if(id_tab=='offre') activer_coins_tab1();
		if(id_tab=='service') activer_coins_tab2();
		if(id_tab=='conseil') activer_coins_tab3();
		if(id_tab=='prod_similaire') activer_coins_tab4();
	}
}

//Premier onglet
function activer_coins_tab1(){
	desactiver_coins_tabs();
	$('coin1_1').className = 'coin1_selected';
	$('coin1_2').className = 'coin_selected';
}

//Second onglet
function activer_coins_tab2(){
	desactiver_coins_tabs();
	$('coin1_2').className = 'coin_selected2';
	$('coin3').className = 'coin_selected';
}

//3eme onglet
function activer_coins_tab3(){
	desactiver_coins_tabs();
	$('coin3').className = 'coin_selected2';
	$('coin4').className = 'coin_selected';
}

//4eme onglet
function activer_coins_tab4(){
	desactiver_coins_tabs();
	$('coin4').className = 'coin_selected2';
	$('coin_finale').className = 'coin_finale_selected';
}

function desactiver_coins_tabs(){
	$('coin1_1').className = 'coin1';
	$('coin1_2').className = 'coin';
	$('coin3').className = 'coin3';
	$('coin4').className = 'coin3';
	$('coin_finale').className = 'coin_finale';
}

 function chargeDetailCommande (numCommande, tr){
	var aoLoader1 = new aoLoader(null,"",{backgroundColor:"#ffffff"});
 		new Ajax.Request("maroquinerie_valise_bagages_sac.gnc?Destination=affPopupBonDeCommandeClient",
	  {
	    method:'get',
	    parameters :"numCommande="+numCommande,
	    onSuccess: function(transport){
	   		var response = transport.responseText || "no response text";
			//ne pas utiliser innerHTML mais la fonction update de prototype
			$('detail_commande_' + numCommande).update(response);
			tr.className = 'produits_select';
			for (var i=0; i<(tr.cells.length)-1; i++) {
				tr.cells[i].className = 'col2_select';
			}
			tr.cells[i].className = '';
			var image = document.getElementById('img_fleche_' + numCommande);
			image.src = 'sites/bagages/images/commande/fleche2.gif';
	    },
	    onComplete: function(transport) {
            aoLoader1.supprimer();
        },
	    onFailure: function(){ alert('Erreur javaScript lors du chagrement du détail commande') }
	  });
 }
 
 function closeDetailCommande (numCommande) {
 	$('detail_commande_' + numCommande).innerHTML="";
 	var elt = document.getElementById('ligne_commande_' + numCommande);
 	elt.className = 'produits';
 	for (var i=0; i<(elt.cells.length)-1; i++) {
		elt.cells[i].className = 'col2';
	}
	elt.cells[i].className = 'last';
	var image = document.getElementById('img_fleche_' + numCommande);
	image.src = 'sites/bagages/images/commande/fleche.gif';
 }
 

 /*-------------------- Fonctions de transfert entre 2 listes multiples -----------------------*/
 
 var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);

 function addOption(theSel, theText, theValue) {
   var newOpt = new Option(theText, theValue);
   var selLength = theSel.length;
   theSel.options[selLength] = newOpt;
 }

 function deleteOption(theSel, theIndex) { 
   var selLength = theSel.length;
   if(selLength>0) {
     theSel.options[theIndex] = null;
   }
 }

 function moveOptions(theSelFrom, theSelTo) {
   
   var selLength = theSelFrom.length;
   var selectedText = new Array();
   var selectedValues = new Array();
   var selectedCount = 0;
   
   var i;
   
   // Find the selected Options in reverse order
   // and delete them from the 'from' Select.
   for(i=selLength-1; i>=0; i--) {
     if(theSelFrom.options[i].selected) {
       selectedText[selectedCount] = theSelFrom.options[i].text;
       selectedValues[selectedCount] = theSelFrom.options[i].value;
       deleteOption(theSelFrom, i);
       selectedCount++;
     }
   }
   
   // Add the selected text/values in reverse order.
   // This will add the Options to the 'to' Select
   // in the same order as they were in the 'from' Select.
   for(i=selectedCount-1; i>=0; i--) {
     addOption(theSelTo, selectedText[i], selectedValues[i]);
   }
   
   updateBoutons(document.form_centres_interet.all_marques, document.form_centres_interet.marques_ci)
   
   if(NS4) history.go(0);
 }
 
 //pour les boutons "ajouter toutes les marques" et "supprimer ma liste"
 function transfertTotal(theSelFrom, theSelTo) {
   
   var selLength = theSelFrom.length;
   var selectedText = new Array();
   var selectedValues = new Array();
   var selectedCount = 0;
   
   var i;
   
   for(i=selLength-1; i>=0; i--) {     
       selectedText[selectedCount] = theSelFrom.options[i].text;
       selectedValues[selectedCount] = theSelFrom.options[i].value;
       deleteOption(theSelFrom, i);
       selectedCount++;
   }

   for(i=selectedCount-1; i>=0; i--) {
     addOption(theSelTo, selectedText[i], selectedValues[i]);
   }
   
   updateBoutons(document.form_centres_interet.all_marques, document.form_centres_interet.marques_ci);
   if(NS4) history.go(0);
 }
 
 //supprime les marques centres d'interet de la liste de toutes les marques
 function initialiserToutesMarques(listeToutesMarques, listeCentresInteret) {

	 var ciLength = listeCentresInteret.length;
	 var marquesLength = listeToutesMarques.length;

	 var i, j;

	 for(i=ciLength-1; i>=0; i--) {
		 for(j=marquesLength-1; j>=0; j--) {  
			 if(listeToutesMarques.options[j].value==listeCentresInteret.options[i].value)  {
				 deleteOption(listeToutesMarques, j);
				 marquesLength--;
			 }
		 }
	 }
	 updateBoutons(listeToutesMarques, listeCentresInteret);
	 if(NS4) history.go(0);
 }
 
 
 //maj l'etat des boutons (enabled ou disabled)
 function updateBoutons(listeToutesMarques, listeCentresInteret) {

	 var ciLength = listeCentresInteret.length;
	 var marquesLength = listeToutesMarques.length;

	 if(ciLength>0){
		 $('supp_liste').className='';
		 $('supp_all').className='';
	 }else{
		 $('supp_liste').className='noslected';
		 $('supp_all').className='noslected';
	 }
	 if(marquesLength>0){
		 $('ajout_liste').className='';
		 $('ajout_all').className='';
	 }else{
		 $('ajout_liste').className='noslected';
		 $('ajout_all').className='noslected';
	 }

	 selection = false;
	 
	 for(i=ciLength-1; i>=0; i--) {
		 if(listeCentresInteret.options[i].selected) {
			 selection = true;
			 break;
		 }
	 }
	 
	 if(selection){
		 $('supp_liste').className='';
	 }else{
		 $('supp_liste').className='noslected';
	 }
	 
	 selection = false;
	 
	 for(i=marquesLength-1; i>=0; i--) {
		 if(listeToutesMarques.options[i].selected) {
			 selection = true;
			 break;
		 }
	 }
	 
	 if(selection){
		 $('ajout_liste').className='';
	 }else{
		 $('ajout_liste').className='noslected';
	 }

 }
 
 
 //selectionne tous les centres d'interet avant le submit
 function selectCentresInterets(listeCentresInteret) {

	 var ciLength = listeCentresInteret.length;
	 var i;

	 for(i=ciLength-1; i>=0; i--) {
		 listeCentresInteret.options[i].selected = true;
	 }
 }