function getTop(deKoi)
{
	var obj = deKoi;
	var curleft = 0;

	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	else
	{
		if (obj.y)
			curleft += obj.y;
	}

	return (curleft);
}

function getLeftImg(deKoi)
{
	var obj = deKoi;
	var curleft = 0;

	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else
	{
		if (obj.x)
			curleft += obj.x;
	}

	return (curleft);
}

function showPreviewBig(idProd,imglist)
{
	div = 'prod'+idProd;

	vartop=getTop(imglist);
	varleft=getLeftImg(imglist);
	
	document.getElementById(div).style.top=-40 + 'px';
	document.getElementById(div).style.left=-70 + 'px';

	document.getElementById(div).style.display="block";	
}

function cachePrevisu(idProd)
{
	div = 'prod' + idProd;
	document.getElementById(div).style.display="none";
}


function livraison_form() {
	var nomodif = document.getElementById('addr_nomodifiable');
	var modif = document.getElementById('addr_modifiable');
	
	modif.style.display='block';		
	nomodif.style.display='none';
}
function livraison_form_1() {
	var nomodif = document.getElementById('addr_nomodifiable');
	var modif = document.getElementById('addr_modifiable');
	
	
	modif.style.display='none';		
	nomodif.style.display='block';
}


function livraison_form2() {
	var nomodif = document.getElementById('addr_nomodifiable2');
	var modif = document.getElementById('addr_modifiable2');
	
	modif.style.display='block';		
	nomodif.style.display='none';

}
function livraison_form2_1() {
	var nomodif = document.getElementById('addr_nomodifiable2');
	var modif = document.getElementById('addr_modifiable2');
	
	modif.style.display='none';		
	nomodif.style.display='block';
}


function file(fichier)
{
	if(window.XMLHttpRequest) // FIREFOX
	  xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // IE
	  xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	else 
	  return(false); 
	xhr_object.open("GET", fichier, false); 
	xhr_object.send(null); 
	if(xhr_object.readyState == 4) return(xhr_object.responseText);
	else return(false);
}

var Error_form = 0;

// Formulaire inscription
function check(champ,NbCarac,idChamp)
{
	//document.getElementById("aide").innerHTML="&nbsp;<img src='/charte/info_ajax_ico.gif' width='15' height='15' align='absmiddle'>";
	

	if(idChamp == 1)
		valeur = "Nom";
	else if(idChamp == 2)
		valeur = "Pr�nom";
	
	if(idChamp == 2) {
		if(champ.value.length < NbCarac) {
			document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";
			Error_form++;			
		}else{
			if(champ.value!=document.register.client_password.value) {
				document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";	
				Error_form++;	
			}else{
				document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/info_ajax_valid.gif' width='15' height='15'>";
			}
		}
	}
	else if(idChamp == 21) {
		
		if(champ.value.length < NbCarac)
		{				
			//if(idChamp == 21) { alert(champ.value); }
				document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";
				Error_form++;	
		}
		else{
			if(isNumeric(champ.value)) {
				document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/info_ajax_valid.gif' alt='valide' />";
			}else{
				document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";
				Error_form++;	
			}
		}
		
	}
	else
	{

		//if(idChamp == 1){ alert(champ.value.length); }

		if(champ.value.length < NbCarac)
		{				
				document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";
				Error_form++;	
		}
		else{
				document.getElementById("valid" + idChamp).innerHTML="<img src='/styles/images/check/info_ajax_valid.gif' alt='valide' />";
		}
	}

	
}

function checkEmail(champ)
{
	//alert(champ.value);
	texte = file('/js/ajax/verifMail.php?mail=' + champ.value);
	if (texte == "true")
	{
		document.getElementById("validEmail").innerHTML="<img src='/styles/images/check/info_ajax_valid.gif' alt='valide' />";
	}
	else{
		document.getElementById("validEmail").innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";
		Error_form++;	
	}
}

function checkEmailParain(champ)
{

	texte = file('/js/ajax/verifMail.php?mail=' + champ.value);
	
	//alert(texte);

	if(texte == "false" && champ.value!="") {
		document.getElementById("validEmail2").innerHTML="<img src='/styles/images/check/croix-rouge.gif' alt='Non valide' />";
		Error_form++;	
	}
	
	if (texte == "true" && champ.value!="")
	{
		document.getElementById("validEmail2").innerHTML="<img src='/styles/images/check/info_ajax_valid.gif' alt='valide' />";
	}
	

	
	if(champ.value=="") {
		document.getElementById("validEmail2").innerHTML="";
	}
	
}

function isNumeric(sText){ 
	var ValidChars = "0123456789."; 
	var IsNumber=true; 
	var Char; 
	for (i = 0; i < sText.length && IsNumber == true; i++){ 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1){ 
			IsNumber = false; 
		} 
	} 
	return IsNumber; 
} 

function showPopupDelai(obj,etat) {
	
	
	var span = document.getElementById('popup_delai');
	if(document.getElementById('produit_note_valeur')){
		var note = document.getElementById('produit_note_valeur');
	}
	if(etat==1) {
		span.style.display="block";	
		if(note){note.style.visibility="hidden";}
	}
	if(etat==0) {
		span.style.display="none";
		if(note){note.style.visibility="visible";}
	}
	
}

function ShowAddresseForm() {
	
	var bloc = document.getElementById('account_create_livr');
	var check = document.getElementById('adresse_identique');
	
	
	if(check.checked==true) {
		bloc.style.display="block";
	}else{
		bloc.style.display="none";
	}
}


var fondDiv = false;
var dataDiv = false;
// Ajout au panier SANS PRODUIT COMPLEMENTAIRE
function addPanier(idForm)
{
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '300px',
	   height: '300px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-150px',	   
	   marginTop: (getScrollTop()-150) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});

	new Ajax(
		'/js/ajax/panier-change.php',
		{
			update: dataDiv,
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
	
					new Ajax(
						'/js/ajax/updatePanier.php',
						{
							update: $('header_mon_panier')
						}
					).request();
					
					
					new Ajax(
						'/js/ajax/updatePanier2.php',
						{
							update: $('header_panier')
						}
					).request();
					
			},
			evalScripts: true
		}
	).request();
}


// Ajout au panier AVEC PRODUIT COMPLEMENTAIRE
function addPanierAjoutProd(idForm)
{
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '650px',
	   height: '470px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-325px',	   
	   marginTop: (getScrollTop()-235) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});

	new Ajax(
		'/js/ajax/panier-change.php',
		{
			update: dataDiv,
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {
				
				data = req.split('|_______|');
				
				if(data[1] == 1) {
					$(dataDiv).setStyles({
					   backgroundColor: '#ffffff',
					   color:'#ffffff',
					   width: '300px',
					   height: '220px',
					   position: 'absolute',
					   border: '1px solid #000',
					   top: '50%',
					   left: '50%',	   
					   marginLeft: '-150px',	   
					   marginTop: (getScrollTop()-150) + 'px',	   	   	   
					   zIndex: '1600',
					   visibility: 'hidden'
					});
				}

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
	
					new Ajax(
						'/js/ajax/updatePanier.php',
						{
							update: $('header_mon_panier')
						}
					).request();
					
					
					new Ajax(
						'/js/ajax/updatePanier2.php',
						{
							update: $('header_panier')
						}
					).request();
					
			},
			evalScripts: true
		}
	).request();
}

// Ajout au panier sans la popup de validation
function addPanier2(idForm)
{
	new Ajax(
		'/js/ajax/panier-change.php',
		{
			update: dataDiv,
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
	
					new Ajax(
						'/js/ajax/updatePanier.php',
						{
							update: $('header_mon_panier')
						}
					).request();
					document.location.reload();
					
					
					new Ajax(
						'/js/ajax/updatePanier2.php',
						{
							update: $('header_panier')
						}
					).request();
					document.location.reload();
					
			},
			evalScripts: true
		}
	).request();
	document.location.reload();
}

// Ajout au panier d'un produit complementaire a 5 %
function addDivPanier(idForm)
{

	new Ajax(
		'/js/ajax/div-panier-change.php',
		{
		
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {
				document.location.href='/shopping_cart.html';
			},
			evalScripts: true
		}
	).request();
}


// Ajout au panier
function addCommandePanier(idForm)
{
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '300px',
	   height: '300px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-150px',	   
	   marginTop: (getScrollTop()-150) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});

	new Ajax(
		'/js/ajax/panier-commande-change.php',
		{
			update: dataDiv,
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
	
					new Ajax(
						'/js/ajax/updateCommandePanier.php',
						{
							update: $('footer_panier')
						}
					).request();
			},
			evalScripts: true
		}
	).request();
}




function removeDivPanier()
{
	if(fondDiv){
		$(fondDiv).remove();
		fondDiv = false;
	}	
	if(dataDiv){
		$(dataDiv).remove();
		dataDiv = false;
	}
	$$('select').setStyles({visibility: 'visible' });		
}

// Ajout newsletter
function addNewsletter(idForm) {
	
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#FFFFFF',
	   width: '300px',
	   height: '150px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-150px',	   
	   marginTop: (getScrollTop()-150) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});
	
	/*
	new Ajax(
		'/js/ajax/newsletter.php',
		{
			method: 'post',
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {
				$(idForm).newsletter_email.value='';
				if(req!="nomail") {
					alert(req);
				}
			},
			evalScripts: true
		}
	).request();*/
	
	new Ajax(
		'/js/ajax/newsletter.php',
		{
			update: dataDiv,
			data:$('frmNewsletter').toQueryString(),
			onSuccess: function(req) {
					$(idForm).newsletter_email.value='';
					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
	
			},
			evalScripts: true
		}
	).request();
	
	
}


function showconseils(id) {
	var block = document.getElementById('block'+id);
	
	if(block.style.display=='none') {
		block.style.display='block';
	}else{
		block.style.display='none';
	}
}

function displayPaiement(etat) {

		
	var block = document.getElementById('cityssimo_content');
	
	if(etat==1) {
		block.style.display='block';
	}else{
		block.style.display='none';
	}
}

function displayMondialRelay(show){
	if(show){
		jQuery('#mondial_relay_content').css('display', 'block');
	}else{
		jQuery('#mondial_relay_content').css('display', 'none');		
	}
}

function updatePointRelais (addr1, addr2, cp, ville){
	jQuery("#mondial_relay_addr1").attr('value', addr1);
	jQuery("#mondial_relay_addr2").attr('value', addr2);
	jQuery("#mondial_relay_cp").attr('value', cp);
	jQuery("#mondial_relay_ville").attr('value', ville);
}

function loadPointMondialRelay(){
	var cp = jQuery("#cp_mondial_relay").attr('value');
	var pays = jQuery("#pays_mondial_relay").attr('value');
	jQuery.ajax({
   type: "POST",
   url: "/js/ajax/loadPointMondialRelay.php",
   data: "code_postal="+cp+"&pays="+pays,
   success: function(rep){
     jQuery('#mondial_relay_content').html(rep);
   }
 });
}
/*
function showDetail PointRelais(node){
	if(jQuery('#'+node).css('display') == 'block'){
		jQuery('#'+node).css('display', 'none');
		jQuery('#lien_'+node).text('+ de d�tail');
	}else{
		jQuery('#'+node).css('display', 'block');
		jQuery('#lien_'+node).text('- de d�tail');
	}
}*/

function removeDiv() {
	if(fondDiv){
		$(fondDiv).remove();
		fondDiv = false;
	}	
	if(dataDiv){
		$(dataDiv).remove();
		dataDiv = false;
	}
	$$('select').setStyles({visibility: 'visible' });
}

function addErrLogin()
{
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});
	
	$(fondDiv).onclick=function() {
		removeDiv();
	}

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#FFFFFF',
	   width: '300px',
	   height: '200px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-150px',	   
	   marginTop: (getScrollTop()-100) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});

	new Ajax(
		'/js/ajax/popup-login.php',
		{
			update: dataDiv,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
	
			},
			evalScripts: true
		}
	).request();
}

function changeAdresse(idForm,adresse,adrType)
{
	selectAdresse=adresse.options[adresse.selectedIndex].value;
	if(selectAdresse=='nouvelle_adresse') {
		addAdresse(idForm,'',adrType);
	}
	else {
		
		if(adrType=='adresse_livraison')
			document.location.href='?new_adresse_livraison_id='+selectAdresse+'&new_adresse_facturation_id='+$(idForm).cur_adresse_facturation.value;
		else
			document.location.href='?new_adresse_livraison_id='+$(idForm).cur_adresse_livraison.value+'&new_adresse_facturation_id='+selectAdresse;
		
	}
}

function addAdresse(idForm,adresse,adrType) {

	
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#FFFFFF',
	   width: '506px',
	   height: '338px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-253px',	   
	   marginTop: (getScrollTop()-169) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});


	cur_adresse_livraison=document.getElementById(idForm).cur_adresse_livraison.value;
	cur_adresse_facturation=document.getElementById(idForm).cur_adresse_facturation.value;

	new Ajax(
		'/js/ajax/addAdresse.php?adresse_id='+adresse+'&adrType='+adrType+'&cur_adresse_livraison='+cur_adresse_livraison+'&cur_adresse_facturation='+cur_adresse_facturation,
		{
			update: dataDiv,
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
					$$('#account_create_livr select').setStyles({visibility: 'visible' });
	
			},
			evalScripts: true
		}
	).request();
}

// Ajout newsletter
function submitAdresse(idForm) {
	
	new Ajax(
		'/js/ajax/submitAdresse.php',
		{
			method: 'post',
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {
				
				retour=req.split('|');
								
				document.location.href='?new_adresse_livraison_id='+retour[0]+'&new_adresse_facturation_id='+retour[1];
				
			},
			evalScripts: true
		}
	).request();
}

// Ajout newsletter
function removeDivAdresse(idForm) {
	document.location.href='?new_adresse_livraison_id='+$(idForm).cur_adresse_livraison.value+'&new_adresse_facturation_id='+$(idForm).cur_adresse_facturation.value;
				
}



function verifAdress(idForm) {
	
	if($(idForm).adresse_libelle.value=='' || ($(idForm).civilite_id1.checked==false && $(idForm).civilite_id2.checked==false && $(idForm).civilite_id3.checked==false) || $(idForm).adresse_nom.value=='' || $(idForm).adresse_prenom.value=='' || $(idForm).adresse_rue.value=='' || $(idForm).adresse_cp.value=='' || $(idForm).adresse_ville.value=='' || $(idForm).pays_id.value=='' || $(idForm).adresse_telephone.value=='') {
		
		alert('Tous les champs marques d\'un asterisque sont obligatoires');
		return false;
	}
	else
		return true;
	
}

function montre(id, id2,boutique)
{
	var d = document.getElementById('smenu'+id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {
			if(i != id2) {
				document.getElementById('smenu'+i).style.display='none';
				//document.getElementById('niv1_'+i).style.color = "#fff";
			}
			else {
				document.getElementById('smenu'+i).style.display='none';
				if (boutique == "")  {
					//document.getElementById('niv1_'+i).style.color = "#ec7615";
				}
				else {
					//document.getElementById('niv1_'+i).style.color = "#cd1531";
				}
			}
			
		}
	}
	if (d) {
		d.style.display='block';
		if (boutique == "") { 
			//document.getElementById('niv1_'+id).style.color = "#ec7615";
		}
		else {
			//document.getElementById('niv1_'+id).style.color = "#cd1531";
		}
	}
	if(id2) {
			if (boutique == "") {
				//document.getElementById('niv1_'+id2).style.color = "#ec7615";
			}
			else {
				//document.getElementById('niv1_'+id2).style.color = "#cd1531";
			}
		}
	
} 

function staymenu(id)
{
	document.getElementById('puce_change'+id).src = "/styles/images/header/bg_menu_left_active.png";
	document.getElementById('niv1_'+i).style.color = "#ec7615";
} 

function showBasket(id,boutique)
{
	var d = document.getElementById('header_mon_panier');
	if (id == 'header_mon_panier') {
		d.style.display='block';
		if(boutique == "")
			document.getElementById('header_panier').style.color="#ec7615";
		else {
			document.getElementById('header_panier').style.color="#cd1531";
		}
	}
	else {
		d.style.display='none';
		document.getElementById('header_panier').style.color="#000";
	}
	
} 

function showhide(id,boutique) {
	var d = document.getElementById(id);
	if (id == 'prod_info') {
		d.style.display='block';
		document.getElementById('liste_prod_assoc_bloc').style.display='block';
		document.getElementById('prod_marque').style.display='none';
		document.getElementById('prod_commentaire').style.display='none';
		if(boutique == "") {
			document.getElementById('prod_info_link').style.color="#ff7b00";
		}
		else {
			document.getElementById('prod_info_link').style.color="#cd1531";
		}
		document.getElementById('prod_marque_link').style.color='#fff';
		document.getElementById('prod_marque_link_h1').style.color='#fff';
		document.getElementById('prod_commentaire_link').style.color='#fff';
	}
	if (id == 'prod_marque') {
		d.style.display='block';
		document.getElementById('liste_prod_assoc_bloc').style.display='block';
		document.getElementById('prod_info').style.display='none';
		document.getElementById('prod_commentaire').style.display='none';
		if(boutique == "") {
			document.getElementById('prod_marque_link').style.color='#ff7b00';
			document.getElementById('prod_marque_link_h1').style.color='#ff7b00';
		}
		else {
			document.getElementById('prod_marque_link').style.color='#cd1531';
			document.getElementById('prod_marque_link_h1').style.color='#cd1531';
		}
		
		document.getElementById('prod_info_link').style.color='#fff';
		document.getElementById('prod_commentaire_link').style.color='#fff';
	}
	if (id == 'prod_commentaire') {		
		d.style.display='block';
		document.getElementById('prod_info').style.display='none';
		document.getElementById('prod_marque').style.display='none';
		document.getElementById('liste_prod_assoc_bloc').style.display='none';
		
		if(boutique == "") {
			document.getElementById('prod_commentaire_link').style.color='#ff7b00';
		}
		else {
			document.getElementById('prod_commentaire_link').style.color='#cd1531';
		}
		
		document.getElementById('prod_marque_link').style.color='#fff';
		document.getElementById('prod_marque_link_h1').style.color='#fff';
		document.getElementById('prod_info_link').style.color='#fff';
	}
}



function checkMailDiag(idForm) {
	
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#FFFFFF',
	   width: '300px',
	   height: '150px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-150px',	   
	   marginTop: (getScrollTop()-150) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});
	
	new Ajax(
		'/js/ajax/checkMailDiag.php',
		{
			update: dataDiv,
			data:$('diagnostic').toQueryString(),
			onSuccess: function(req) {
					$(idForm).men_quizz_email.value='';
					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
	
			},
			evalScripts: true
		}
	).request();
	
	
}

function cacheselect()
{
	var Navigateur = navigator.appName;
	var b_version = navigator.appVersion;

	if(Navigateur == "Microsoft Internet Explorer" && b_version.substring(22,25)<7) {
		$$('select').setStyles({visibility: 'hidden' });
	}
}

function affselect()
{
	var Navigateur = navigator.appName;
	if(Navigateur == "Microsoft Internet Explorer")  {
		$$('select').setStyles({visibility: 'visible' });
	}
}

/*
function calculprix(produit_id,produit_option_valeur_id,produit_option_valeur_id_bis) {
	new Ajax(
		'/js/ajax/calculprix.php',
		{
			update: $('info_bloc_prix'),
			data:"produit_id="+produit_id+"&produit_option_valeur_id="+produit_option_valeur_id+"&produit_option_valeur_id_bis="+produit_option_valeur_id_bis,
			onSuccess: function(req) {
				
			},

			evalScripts: true
		}
	).request();	
}
*/

/* SELECT FICHE PRODUIT 
function select_taille(obj,produit_id,produit_option_valeur_id,etat){

	$$('#list_att li.active').removeClass('active');
	$(obj).addClass('active');


	havepalette(produit_id, produit_option_valeur_id);
	

	
	if(etat==1) {
		calculprix(produit_id,produit_option_valeur_id,'-3');
	}else{
		calculprix(produit_id,produit_option_valeur_id,'-2');
	}

}


function havepalette(produit_id, produit_option_valeur_id) {
	new Ajax(
		'/js/ajax/havepalette.php',
		{
			update: $('bloc_color'),
			data:"produit_id="+produit_id+"&produit_option_valeur_id="+produit_option_valeur_id,
			onSuccess: function(req) {
				
			},

			evalScripts: true
		}
	).request();		
}

*/

/* SELECT FICHE PRODUIT */
function select_taille(obj, produit_id, id_taille, nom_taille, boutique_id){
	
	for (var i = 0; i<=20; i++) {
		if (document.getElementById('litaille_'+i)) {
				document.getElementById('litaille_'+i).style.color='#614F46';
				document.getElementById('litaille_'+i).style.border='1px solid #614F46';
		}
	}
	
	//$('recepttaille').innerHTML = nom_taille;
	//$('recepttaille').style.display="block";
	//$('attribut_combinaison').style.display="block";
	if($('produit_option_valeur_id')) $('produit_option_valeur_id').value = id_taille;
	
	if (boutique_id) {
		$(obj).style.color='#CD1531';
		$(obj).style.border='2px solid #CD1531';
	}
	else {
		$(obj).style.color='#FD7602';
		$(obj).style.border='2px solid #FD7602';
	}
	
	
	var id_coul = document.getElementById('produit_option_valeur_id_bis').value;
	
	new Ajax(
		'/js/ajax/haveAttribut.php',
		{
			update: $('attribut_du_produit'),
			data:"produit_id="+produit_id+"&produit_option_valeur_id="+id_taille+"&produit_option_valeur_id_bis="+id_coul,
			onSuccess: function(req) {
				
			},

			evalScripts: true
		}
	).request();	
}

function select_couleur(obj, produit_id, id_coul, nom_coul,img_url_detail, img_url, boutique_id){
	
	for (var i = 0; i<=20; i++) {
		if (document.getElementById('licoul_'+i)) {
				document.getElementById('licoul_'+i).style.border='1px solid #614F46';
		}
	}
	
	if(img_url_detail != '') {
		$('photohover_detail').src = img_url_detail;
		$('photohover').src = img_url;
	}
	
	//$('receptcolor').innerHTML = nom_coul;
	//$('receptcolor').style.display="block";
	//$('attribut_combinaison').style.display="block";
	if($('produit_option_valeur_id_bis')) $('produit_option_valeur_id_bis').value = id_coul;
	//if($('produit_option_valeur_id')) $('produit_option_valeur_id').value = '';
	
	if (boutique_id) $(obj).style.border='2px solid #CD1531';
	else $(obj).style.border='2px solid #FD7602';
	
	if($('produit_option_valeur_id')){
		var id_taille = $('produit_option_valeur_id').value;
		
		new Ajax(
			'/js/ajax/haveAttribut.php',
			{
				update: $('attribut_du_produit'),
				data:"produit_id="+produit_id+"&produit_option_valeur_id="+id_taille+"&produit_option_valeur_id_bis="+id_coul,
				onSuccess: function(req) {
					
				},
	
				evalScripts: true
			}
		).request();
	}
}

var fondDiv = false;
var dataDiv = false;

function view_dispo(produit_id) {
	
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#ffffff',
	   //width: '300px',
	   //height: '300px',
	   width: '700px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-350px',	   
	   marginTop: (getScrollTop()-150) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});

	new Ajax(
		'/js/ajax/produit_attribut_disponibilite.php',
		{
			update: dataDiv,
			data:"produit_id="+produit_id,
			onSuccess: function(req) {
					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();
}

function view_gdt() {
	
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});
	
	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#ffffff',
	   //width: '300px',
	   //height: '300px',
	   width: '700px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '20%',
	   left: '50%',	   
	   marginLeft: '-350px',	   
	   marginTop: (getScrollTop()-150) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});
	
	$(fondDiv).onclick = function(){
        removeDivPanier();
    }

	new Ajax(
		'/js/ajax/gdt.php',
		{
			update: dataDiv,
			onSuccess: function(req) {
					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();
}

function calculprix(produit_id,produit_option_valeur_id,produit_option_valeur_id_bis) {
		
	if(produit_option_valeur_id == '') {
		if($('produit_option_valeur_id')) produit_option_valeur_id = $('produit_option_valeur_id').value;
	}
	if(produit_option_valeur_id_bis == '') {
		produit_option_valeur_id_bis = $('produit_option_valeur_id_bis').value;
	}
	new Ajax(
		'/js/ajax/calculprix.php',
		{
			update: $('info_bloc_prix'),
			data:"produit_id="+produit_id+"&produit_option_valeur_id="+produit_option_valeur_id+"&produit_option_valeur_id_bis="+produit_option_valeur_id_bis,
			onSuccess: function(req) {
				arr = req.split("|");
				$('info_bloc_prix').innerHTML = arr[0];
				$('prodatt_livraison').innerHTML = arr[1];
				$('prodatt_reference').innerHTML = arr[2];
				$('bloc_ajout_panier').innerHTML = arr[3];
			},

			evalScripts: true
		}
	).request();	
}

function showImage(produit_id,produit_option_valeur_id_bis,img_url_detail, img_url) {
	
	/*
	if(produit_option_valeur_id_bis == '') {
		if($('produit_option_valeur_id_bis')){
			produit_option_valeur_id_bis = $('produit_option_valeur_id_bis').value;
		}else{
			return;
		} 
	}
	
	new Ajax(
		'/js/ajax/viewImageColor.php',
		{
			update: $('imgf'),
			data:"produit_id="+produit_id+"&produit_option_valeur_id_bis="+produit_option_valeur_id_bis,
			onSuccess: function(req) {
				
			},

			evalScripts: true
		}
	).request();	
	*/
	if(img_url_detail!='') {
		$('photoprod').src=img_url_detail;
		$('photobig').src=img_url;
	}
	else {
		$('photoprod').src=$('photohover_detail').src;
		$('photobig').src=$('photohover').src;
	}
		
}

function remove_loupe()
{
	if(edz_zooms)
	{
		if(edz_zooms._zoomCur) edz_zooms._zoomCur._divLoupe.style.display='none';
	}
}

function showPopupPDF(etat) {
	
	
	var span = document.getElementById('popup_pdf');
	if(etat==1) {
		span.style.display="block";	
	}
	if(etat==0) {
		span.style.display="none";
	}
	
}

function picto(pictoid, pictoimg, pictocolor, pictoborder, pictobackground) {
	
	if(pictobackground!='') {
		document.getElementById('div'+pictoid).style.background = "#"+pictobackground;	
	} else {
		document.getElementById('div'+pictoid).style.background = "transparent";	
	}
	
	if(pictoborder!='') {
		document.getElementById('div'+pictoid).style.border = "#"+pictoborder+" 1px solid";	
	} else {
		document.getElementById('div'+pictoid).style.border = "#ffffff 1px solid";	
	}
	
	if(pictocolor!='') {
		document.getElementById('nom'+pictoid).style.color = "#"+pictocolor+"";	
	}
	
	if(pictoimg!='') {
		document.getElementById('img'+pictoid).src = pictoimg;	
	}
	
}


//select couleur
// affiche toutes les tailles et grises celles qui sont non dispo
function affiche_taille(produit_id, produit_option_valeur_id_bis) {
	var taille = $('produit_option_valeur_id').value;
	new Ajax(
		'/js/ajax/afficheTaille.php',
		{
			update: $('inc_produit_taille'),
			data:"produit_id="+produit_id+"&produit_option_valeur_id="+taille+"&produit_option_valeur_id_bis="+produit_option_valeur_id_bis,
			onSuccess: function(req) {
			},

			evalScripts: true
		}
	).request();	
}



var fondDiv = false;
var dataDiv = false;

function popUpAlerte(produit_id,produit_attribut_id,client_email,err,addok) {
	
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '300px',
	   height: '300px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-170px',	   
	   marginTop: (getScrollTop()-150) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});
	

	new Ajax(
		'/js/ajax/alerte_produit.php',
		{
			update: dataDiv,
			data:"produit_id="+produit_id+"&produit_attribut_id="+produit_attribut_id+"&client_email="+client_email+"&err="+err+"&addOK="+addok,
			onSuccess: function(req) {
					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();
}

function popup_echantillons() {
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '700px',
	   height: '460px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-400px',	   
	   marginTop: (getScrollTop()-300) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});
	

	new Ajax(
		'/js/ajax/popup_echantillons.php',
		{
			update: dataDiv,
			onSuccess: function(req) {
					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();
}

function updateFormContact(idObjet){
	if(idObjet == '4'){
		document.getElementById('contact_numero_commande').style.display='block';
		document.getElementById('num_commande').disabled=false;
	}else{
		document.getElementById('contact_numero_commande').style.display='none';
		document.getElementById('num_commande').disabled='disabled';
	}
}

function selectSujetParent(sujet_id){
	jQuery.ajax({
		type: "POST",
		url: "/js/ajax/selectSujetParent.php",
		data: "sujet_id="+sujet_id,
		success: function(rep){
			jQuery('#contentformsujet').html(rep);
		}
	});
}

function updateSujet(){
	jQuery.ajax({
		type: "POST",
		url: "/js/ajax/updateSujet.php",
		data: jQuery('#formsujet').serialize(),
		success: function(rep){
			jQuery('#contentformsujet').html(rep);
		}
	});
}

function addRetour() {
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});
	
	$(fondDiv).onclick=function() {
		removeDiv();
	}

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '300px',
	   height: '200px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-150px',	   
	   marginTop: (getScrollTop()-100) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});
	

	new Ajax(
		'/js/ajax/createBr.php',
		{
			update: dataDiv,
			data:$("formsujet").toQueryString(),
			onSuccess: function(req) {
					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();
}


function addPj() {
	var txtpresent = jQuery("#contentpj").html();
	var addtxt = '<div style="padding-top:20px;" class="contact_frm"><label for="mail_contenu">Pi&egrave;ce(s) jointe(s) :</label><input type="file" id="fichier" name="fichier[]" size="35"></div>';
	jQuery("#contentpj").html(txtpresent+addtxt);
}
