





// Affichage du bloc qui gère le numero de retour
function showNumRetourEtiquette(idOrder, parentPath) {


	// ELEMENT DU DIV POPUP
	var numDIVObjet = document.getElementById('popup_numero_retour');
	var numObjet = document.getElementById('num_retourDIV');
	
	// ELEMENT DU BLOC DANS LE DETAIL
	var divPrintPdfObjet		= document.getElementById('printPdf');
	var divCreateNumRetourObjet = document.getElementById('createNumRetour');
	var numRetourObjet			= document.getElementById('num_retour');
	
		
	var numRetour = ''; 
	
	// expression régulière qui servira au decoupage de la reponse
	var numRetour = ajax_file( parentPath + 'ajax_num_etiquette.php?idOrder=' + idOrder );

	// Securité : la commande n'appartient pas au client connecté
	if (numRetour!='false'){
		
		numDIVObjet.style.display = 'block';
		numObjet.innerHTML = numRetour;
		
		numRetourObjet.innerHTML = numRetour;				
		divCreateNumRetourObjet.style.display = 'none';
		divPrintPdfObjet.style.display = 'block';
		
		document.getElementById('shad').style.display = 'block';
	}
}

function createEtiquetteRetour(idOrder, parentPath){
	
	$("input[name=impression_etiquette]").hide();
	$("<div>", {id:"loader_retour"}).html('<img src="'+parentPath+'img/loader.gif" />').insertAfter("input[name=impression_etiquette]");
	
	var choixRetourDivObjet = document.getElementById('choixRetourDiv');
	var choixRetourObjet = document.getElementById('choixRetour');
	var choix = 0;
	
	if (choixRetourObjet.value != '0')
		choix = choixRetourObjet.value;
	else
		choix = choixRetourDivObjet.value;
	
	switch (choix){
			case '1':
				var txtRaison = 'Droits de rétractation';
				break;
			case '2':
				var txtRaison = 'Article non conforme à la commande';
				break;
			case '3':
				var txtRaison = 'Article Cassé / Défectueux';
				break;
			case '4':
				var txtRaison = 'Problème de Taille / Qualité';
				break;	
			case '5':
				var txtRaison = 'Autres';		
				break;
	}
	
//	if( choix != 1 && choix != 5 ) {
	
		var response = ajax_file( parentPath + 'ajax_create_etiquette.php?idOrder=' + idOrder + '&choix=' + txtRaison + '&numChoix=' + choix);
		
		if(response){
			
			var listeRaisonBlocObjet = document.getElementById('liste_motif_retour');
			var btnPrintPdfBlocObjet = document.getElementById('btnPrintPdf');
			
			if(txtRaison == "Autres"){
				listeRaisonBlocObjet.innerHTML = '<u>Raison du retour</u> : ' + txtRaison + '<input type="hidden" id="choixRetour" value="'+choix+'">';
			}
			else
			{
				listeRaisonBlocObjet.innerHTML = txtRaison + '<input type="hidden" id="choixRetour" value="'+choix+'">';
			}
			
			btnPrintPdfBlocObjet.style.display = 'block';
			
			document.getElementById('shad').style.display = 'none';
			document.getElementById('popup_numero_retour').style.display = 'none';

			window.open(response);		
		}
		
//	}

	// Loader
	$("div").remove("#loader_retour");
	$("input[name=impression_etiquette]").show();

}

// Affiche la liste des sous categories d'un produit
function	 showSousCategOptionListe(objCateg, objSousCategId, objetId, idSousCateg ) {

	var optionSousCateg = document.getElementById(objSousCategId);
	var optionObjet = document.getElementById(objetId);

	if ( objCateg.value != 'non_attribue' ){

			
		var response = ajax_file('../ajax/ajax_sousCateg_optionliste.php?idCateg=' + objCateg.value 
								 + '&index=' + objSousCategId.split('_')[1] + '&idSousCateg=' + idSousCateg);
		
		optionSousCateg.style.display = 'block';
		optionObjet.style.display = 'none';
		if (response == '') { optionSousCateg.innerHTML = ''; optionObjet.innerHTML = ''; }
		else { optionSousCateg.innerHTML = response; optionObjet.innerHTML = ''; }
	
	}else{
		optionSousCateg.innerHTML = '';
		optionObjet.innerHTML = '';
	}
}
// --------------------------------------------------------------------------------

// Affiche la liste des objets d'un produit
function	showObjetOptionListe(objSousCateg,objetId, idObjet) {
	var optionObjet = document.getElementById(objetId);
	var response = ajax_file('../ajax/ajax_objet_optionliste.php?idSousCateg=' + objSousCateg.value 
							 + '&index=' + objetId.split('_')[1] + '&idObjet=' + idObjet);
	optionObjet.style.display = 'block';
	if (response)
		optionObjet.innerHTML = response;
	else
		optionObjet.innerHTML = '';	
		
}
// --------------------------------------------------------------------------------

// Affiche la liste des auantites d'un produit (HTML Tag select)
function showQteListe(elementID, idProduit,parentPath) {
	
	var listQte = document.getElementById(elementID);
	var alternative_listQte = document.getElementById('liste_qte_spe');
	
	if (listQte || alternative_listQte) {
	
		if(listQte){
			listQte.innerHTML = '<table border="0" cellpadding="0" cellspacing="0" style="padding-left:30px;"><tr><td style="font-size:11px;"><img src="' + parentPath + 'img/sablier.gif" />Chargement...</td></tr></table>';
			var couleurs = document.getElementById('couleurProd');
			var tailles = document.getElementById('tailleProd');
		}
		else{
			var couleurs = 'none';
			var tailles = 'none';
			alternative_listQte.innerHTML = '<table border="0" cellpadding="0" cellspacing="0" style="padding-left:30px;"><tr><td style="font-size:11px;"><img src="' + parentPath + 'img/sablier.gif" />Chargement...</td></tr></table>';
		}
		
		var couleur_val = couleurs.value;
		if( typeof(couleurs.value) == 'undefined' )
			couleur_val =  '';
		
		// KP : on va regarder s'il reste des couleurs
		if( couleur_val != '' )	{

			var has_stock = ajax_file( parentPath + 'ajax_check_stock_color.php?idprod=' + idProduit + '&idcouleur=' + couleur_val );
			if( has_stock == 'false' ) {
			
				$("#"+couleur_val+"_prod").parent().css('display','none');
				
				// On va enlever l'element dans le tableau
				removeByValue(tab_color_border,couleur_val);
				
				if( tab_color_border.length == 0 )
					$("#ligne_couleur").css('display','none');
				else
					changeColorProduct( tab_color_border[0], 'produit', '' );
			
			}
		
		}			
		
		var taille_id = 'undefined';
		
		if ( tailles )
						taille_id = tailles.value;
				//if (couleurs.value != "" && tailles.value != "") {
					var response = ajax_file(parentPath + 'ajax_liste_qte.php?idprod=' + idProduit + '&idcouleur=' + couleur_val + '&idtaille=' + taille_id);
					if (response){
						if(listQte) listQte.innerHTML = response;
						else alternative_listQte.innerHTML = response;
					}	
				//}
				//else
//					listQte.innerHTML = '';
	}
}

function showQteListeGamme(elementID, idProduit,parentPath) {
	var listQte = document.getElementById(elementID);
	var alternative_listQte = document.getElementById('liste_qte_spe_'+idProduit);
	if (listQte || alternative_listQte) {
	//alert('qteProd_'+idProduit);
		if(listQte){
			var couleurs = document.getElementById('couleurProd_'+idProduit).value;
			var tailles = document.getElementById('tailleProd_'+idProduit).value;
			listQte.innerHTML = '<table border="0" cellpadding="0" cellspacing="0" style="padding-left:30px;"><tr><td style="font-size:11px;"><img src="' + parentPath + 'img/sablier.gif" />Chargement...</td></tr></table>';
		}
		else{
			var couleurs = 'none';
			var tailles = 'none';
			alternative_listQte.innerHTML = '<table border="0" cellpadding="0" cellspacing="0" style="padding-left:30px;"><tr><td style="font-size:11px;"><img src="' + parentPath + 'img/sablier.gif" />Chargement...</td></tr></table>';
		}
		
		if( typeof(couleurs) == 'undefined' )
			couleurs =  '';
			
		// KP : on va regarder s'il reste des couleurs
		if( couleurs != '' )	{

			var has_stock = ajax_file( parentPath + 'ajax_check_stock_color.php?idprod=' + idProduit + '&idcouleur=' + couleurs );
			if( has_stock == 'false' ) {
				
				var tab_test = eval('tab_color_border_assoc_' + idProduit);
				
				if( tab_test.in_array( couleurs ) ) {
					
					var tab	= eval('tab_color_border_assoc_' + idProduit);
					var txt = 'assoc';
					
				}
				else {
					
					var tab	= eval('tab_color_border_gamme_' + idProduit);
					var txt = 'gamme';
					
				}
				
				$("#"+couleurs+"_"+txt).parent().css('display','none');
				
				// On va enlever l'element dans le tableau
				removeByValue(tab,couleurs);
				
				if( tab.length == 0 )
					$("#"+couleurs+"_"+txt).parent().parent().css('display','none').parent().prev().css('display','none');
				else
					changeColorProduct( tab[0], 'txt', idProduit );
			
			}
		
		}
	
		//if (couleurs.value != "" && tailles.value != "") {
			var response = ajax_file(parentPath + 'ajax_liste_qte_alerte.php?idprod=' + idProduit + '&idcouleur=' + couleurs + '&idtaille=' + tailles);
			if (response){
				if(listQte) listQte.innerHTML = response;
				else alternative_listQte.innerHTML = response;
			}	
		//}
		//else
//			listQte.innerHTML = '';
	}
}

// Verifie si le produit ou la commande existe
function verif_base(elementID, val, parentPath) {
	var mess = document.getElementById(elementID);
	if (elementID=='mess_num_commande') var variable = 'numCommande';
	else var variable = 'refProduit';
	
	if (mess) {
		var response = ajax_file(parentPath + 'ajax_verif_contact.php?'+variable+'='+ val );
		if (response) {
			mess.innerHTML = response;
			var nom_label = document.getElementById('contactNomLabel');
			var td_img = document.getElementById('preview_tof');
			
			if(variable=='refProduit') {
				if(!document.getElementById('erreur')) {
					var img_name = document.getElementById("img_name").value;
					var img_rep = document.getElementById("dir").value;
					var img_type = document.getElementById("image_type").value;
					var td = document.createElement('td');
					td.setAttribute('id','preview_tof');
					if (document.all){
						td.style.setAttribute('cssText','padding-left:45px;');
						if(img_type=='vert') td.style.setAttribute('cssText','padding-left:45px;vertical-align:top;padding-top:7px;');
					}						
					else{
						td.setAttribute('style','padding-left:45px;');
						if(img_type=='vert') td.setAttribute('style','padding-left:45px;vertical-align:top;padding-top:7px;');
					}
					td.rowSpan=5;
					
					var img = document.createElement('img');
					var dest_img = img_rep+img_name+'.jpg';
					img.setAttribute('src', dest_img);
					img.setAttribute('id',img_name);
					
					if(img_type=='hor') img.setAttribute('class','cadre_photo_hor');
					else img.setAttribute('class','cadre_photo_vert');
					
					td.appendChild(img);
					if(!td_img) nom_label.parentNode.parentNode.appendChild(td);
				}
				else 
				{
					var nom_label = document.getElementById('contactNomLabel');
					if(td_img) nom_label.parentNode.parentNode.removeChild(td_img);
				}
			}
		}
		else mess.innerHTML = "";
	}
}

function showQteListeAssoc(elementID, idProduit, parentPath) {
	
	var listQte = document.getElementById(elementID);
	var alternative_listQte = document.getElementById('liste_qte_spe_'+idProduit);
	listQte.innerHTML = '<table border="0" cellpadding="0" cellspacing="0" style="padding-left:10px;"><tr><td style="font-size:11px;"><img src="' + parentPath + 'img/sablier.gif" />Chargement...</td></tr></table>';
	var couleurs = document.getElementById('couleurProdAssoc_'+idProduit);
	var tailles = document.getElementById('tailleProdAssoc_'+idProduit);
	if (listQte || alternative_listQte) {
	
		if(listQte){
			var couleurs = document.getElementById('couleurProd_'+idProduit).value;
			var tailles = document.getElementById('tailleProd_'+idProduit).value;
			listQte.innerHTML = '<table border="0" cellpadding="0" cellspacing="0" style="padding-left:10px;"><tr><td style="font-size:11px;"><img src="' + parentPath + 'img/sablier.gif" />Chargement...</td></tr></table>';
		}
		else{
			var couleurs = 'none';
			var tailles = 'none';
			alternative_listQte.innerHTML = '<table border="0" cellpadding="0" cellspacing="0" style="padding-left:10px;"><tr><td style="font-size:11px;"><img src="' + parentPath + 'img/sablier.gif" />Chargement...</td></tr></table>';
		}
	
		//if (couleurs.value != "" && tailles.value != "") {
			var response = ajax_file(parentPath + 'ajax_liste_qte_alerte.php?idprod=' + idProduit + '&idcouleur=' + couleurs.value + '&idtaille=' + tailles.value);
			if (response) {
				// On exécute deux fois car replace ne remplace qu'une seule fois alors que nous avons deux occurences
				response = response.replace( 'qteProd_', 'qteProdAssoc_' );
				response = response.replace( 'qteProd_', 'qteProdAssoc_' );
				if(listQte) listQte.innerHTML = response;
				else alternative_listQte.innerHTML = response;
				
			}
		//}
		//else
//			listQte.innerHTML = '';
	}
}

function showTailleListeGamme(elementID, idProduit,parentPath, tailleProd) {
	
	var eltaille = document.getElementById( elementID );
	
	if (eltaille) {
		var response = ajax_file(parentPath + 'ajax_liste_taille.php?idprod=' + idProduit + '&tailleprod = ' + tailleProd);
		if ( response ) {
			
			eltaille.innerHTML = response;
			//showQteListeGamme('liste_qte_<?php echo $produits->produit_id;?>', '<?php echo $produits->produit_id;?>', '');
			
		} else {
			
			//showQteListeGamme('liste_qte_<?php echo $produits->produit_id;?>', '<?php echo $produits->produit_id;?>', '');
			
		}
		
	}
		
}



function showTailleListeAssoc(elementID, idProduit, parentPath, tailleProd) {
	
	var eltaille = document.getElementById( elementID );
	
	if (eltaille) {
		var response = ajax_file(parentPath + 'ajax_liste_taille.php?idprod=' + idProduit + '&tailleprod = ' + tailleProd);
		
		if ( response ) {
			
			response = response.replace('tailleProd_', 'tailleProdAssoc_');
			response = response.replace('tailleProd_', 'tailleProdAssoc_');
			response = response.replace('liste_qte_', 'liste_qte_assoc_');
			response = response.replace('showQteListeGamme', 'showQteListeAssoc');
			eltaille.innerHTML = response;
			
			//showQteListeAssoc('liste_qte_assoc_<?php echo $produits->produit_id;?>', '<?php echo $produits->produit_id;?>', '');
			
		} else {
			
			//showQteListeAssoc('liste_qte_assoc_<?php echo $produits->produit_id;?>', '<?php echo $produits->produit_id;?>', '');
			
		}
	}
}


function checkStocksProduct() {
	var id_product_element = document.getElementById('produit_id');
	
	if (id_product_element) {
		var id_product = id_product_element.value;
		
		var response = ajax_file(parentPath + 'ajax/ajax_check_stock.php?id_product='+id_product);
		
		if (response && response < 1) {
			
			alert(ajax_file('ajax_sprintf.php?arg1=js_error_no_stock'));
			return false;
			
		}
		
		return true;
	}
}

// Classe les categories 
function ajax_classer(){
	var sortable1 = Sortable.serialize('list1');
	var sortable2 = Sortable.serialize('list2');
	//var sortable3 = Sortable.serialize('list3');
	
	
	
	//var response = ajax_file('ajax/ajax_classer_categ.php?' + sortable1 + '&' + sortable2 + '&' + sortable3);
	var response = ajax_file('ajax/ajax_classer_categ.php?' + sortable1 + '&' + sortable2);

	if (response){
		var message = document.getElementById('messFinish');
		message.style.display = "block";
		Effect.Pulsate(message);
	}

}
// --------------------------------------------------------------------------------

// Affiche la liste des auantites d'un produit (HTML Tag select)
function	showQteListePanier(elementID, idProduit, i, paniervirtuelId) {
	
	var listQtePanier = document.getElementById(elementID);
	
	var couleurs = document.getElementById('couleurProd'+i);
	var tailles = document.getElementById('tailleProd'+i);
	
	var idCouleur = 0;
	var idTaille = 0;
	
	if (couleurs) idCouleur = couleurs.value;
	if (tailles) idTaille = tailles.value;
	
	if (listQtePanier) {
			var response = ajax_file('ajax/ajax_liste_qte_panier.php?idprod=' + idProduit + '&idcouleur=' + idCouleur + '&idtaille=' + idTaille + '&i=' + i + '&panierId=' + paniervirtuelId );
			if (response)
				listQtePanier.innerHTML = response;
	}
}

function updatePanier(idProduit, i, paniervirtuelId){
	var couleurs = document.getElementById('couleurProd'+i);
	var tailles = document.getElementById('tailleProd'+i);
	var qte = document.getElementById('ProdQte'+i);

	var idCouleur = 0;
	var idTaille = 0;
	
	if (couleurs) idCouleur = couleurs.value;
	if (tailles) idTaille = tailles.value;
	

	ajax_file('ajax/ajax_upd_panier.php?idprod=' + idProduit + '&idcouleur=' + idCouleur + '&idtaille=' + idTaille + '&qte=' + qte.value + '&panierId=' + paniervirtuelId);
}

function newUpdatePanier(idProduit, i, paniervirtuelId, prixU, type_ajout, path_web, titreObjet, idElTaille, lastTaille, idElCouleur, lastCouleur, idQte, path_photo, description, code_color, nom_color){
	
	if (i != '') {
		
		
		i = '_'+i;
		
		prixU = document.getElementById('prixU'+i).value;
		
	}
	
	var couleurs = document.getElementById('couleurProd'+i);
	var tailles = document.getElementById('tailleProd'+i);
	
	if(tailles && tailles.value == '') {
		
		alert(ajax_file(path_web+'ajax_sprintf.php?arg1=js_error_size'));
		return false;
		
	} else if(couleurs && couleurs.value == '') {
		
		alert(ajax_file(path_web+'ajax_sprintf.php?arg1=js_error_couleur'));
		return false;
		
	} else if (document.getElementById('qteProd'+i) && document.getElementById('qteProd'+i).value == '') {
		
		alert(ajax_file(path_web+'ajax_sprintf.php?arg1=js_error_quantity'));
		return false;
		
	} else {
		
		var qte = 0;
		
		if (document.getElementById('qteProd'+i)) {
			
			qte = document.getElementById('qteProd'+i).value;
			
		}
		
		var idCouleur = 0;
		var idTaille = 0;
		
		if (couleurs) idCouleur = couleurs.value;
		if (tailles) idTaille = tailles.value;
		
		var array_response = new Array();
		var response = ajax_file(path_web+'ajax_upd_panier.php?prixu=' + prixU + '&idprod=' + idProduit + '&idcouleur=' + idCouleur + '&idtaille=' + idTaille + '&qte=' + qte + '&panierId=' + paniervirtuelId);
		
		if (response) {
	
			array_response = response.split("//");
			array_response_1 = response.split("<br>");
			
			array_response_2 = array_response_1[2].split("//");
			var designation = array_response_2[0];
			
			if ( titreObjet.match('^[0-9]') ) {
			
				if ( designation == 1 ) {
				
					designation += ' lot de';
					
				} else {
					
					designation += ' lots de';
					
				}
				
			}
			
			designation += ' - ' + titreObjet;
			
			if ( document.getElementById(idElTaille) ) {
				
				if( idElTaille == 'tailleUnique' )
					designation += ' - Taille Unique';
				else {
				
					if ( document.getElementById(idElTaille).selectedIndex ) {
						
						designation += ' - ' + document.getElementById(idElTaille).options[document.getElementById(idElTaille).selectedIndex].text;
						
						
					} else if ( lastTaille != '' ) {

						designation += ' - ' + document.getElementById(idElTaille).options[document.getElementById(idElTaille).selectedIndex].text;
						
					}
				
				}
			
			} else 
				designation += ' - Taille Unique';
			
			if ( document.getElementById(idElCouleur) ) {
				
				if ( document.getElementById(idElCouleur).selectedIndex ) {
				
					designation += ' - ' + document.getElementById(idElCouleur).options[document.getElementById(idElCouleur).selectedIndex].text;
					
				} else if ( lastCouleur != '' ) {
				
					designation += ' - ' + nom_color;
					
				}
				
			}
			
			var lettre = 'A';
			if( type_ajout == 'assoc' ) {
			
				if(eval('tab_color_lettre_assoc_' + idProduit).in_array( code_color ))
					lettre = code_color;
			
			}
			else if( type_ajout == 'gamme' ) {
			
				if(eval('tab_color_lettre_gamme_' + idProduit).in_array( code_color ))
					lettre = code_color;
			
			}
			else {
			
				if(tab_color_lettre.in_array( code_color ))
					lettre = code_color;
					
			}
			
			designation += ' - ' + path_photo + lettre +'.jpg';
			designation += ' - ' + description;
			array_response[0] = designation;
			
		}
		
		return array_response;
	}
}

function	showMontanTotalProduit(elementID, i){
	var montantProduit = document.getElementById(elementID);
	qte = document.getElementById("ProdQte"+i);
	prix = document.getElementById("prixProd"+i);
	
	var response = ajax_file('ajax/ajax_montant_total_produit.php?qte=' + qte.value + '&prix=' + prix.value );
	
	if (response)
				montantProduit.innerHTML = response;
}

function showMontanTotalPanier(elementID){
		var montantTotalPanier = document.getElementById(elementID);
		var response = ajax_file('ajax/ajax_montant_total_panier.php');
		
		if (response)
				montantTotalPanier.innerHTML = response;
		
}
//Affiche la liste des questions appropriées au service demandé
function show_question(elementID, fieldID, idService, parentPath) {
	
	var list_question = document.getElementById(elementID);
	clearTimeout(time_out);
	var field = document.getElementById(fieldID);
	if (list_question) {
		var response = ajax_file(parentPath + 'ajax_list_question.php?idService=' + idService);
		if (response) {
			list_question.innerHTML = response;
			field.innerHTML = "";
		}
	}
}

/*// Affiche les champs appropriées au service et à la question demandé
function show_fields(elementID, idService, idQuestion, parentPath) {
	
	var list_field = document.getElementById(elementID);
	clearTimeout(time_out);
	if (list_field) {
		var response = ajax_file(parentPath + 'ajax_field_contact.php?idService=' + idService + '&idQuestion=' + idQuestion);
		if (response)
			list_field.innerHTML = response;
		else
			list_field.innerHTML = '';
	}
}*/

// Affiche les champs appropri?es au service et ? la question demand?
function show_fields(elementID, idService, idQuestion, parentPath) {
	
	var list_field = document.getElementById(elementID);
	clearTimeout(time_out);
	if (list_field) {
		var response = ajax_file(parentPath + 'ajax_field_contact.php?idService=' + idService + '&idQuestion=' + idQuestion);
		if (response) {
			list_field.innerHTML = response;
			
			tabError = new Array();
			tabError[0] = new Array('alpha','contactNom','contact_field_nom');
			tabError[1] = new Array('alpha','contactPrenom','contact_field_prenom');
			tabError[2] = new Array('mail','contactMail','contact_field_mail');
			
			var i = 3;
			
			if( idService == 2 && idQuestion == 6 ) {
				tabError[i] = new Array('alphanum','contactRefProduit','contact_field_ref_produit');
				i++;
			}
			if( idService == 2 && idQuestion == 5 ) {
				tabError[i] = new Array('alphanum','contactRefProduit','contact_field_ref_produit');
				i++;
			}
			
			tabError[i] = new Array('no_empty','contactMessage','contact_field_message');
			
		}
		else
			list_field.innerHTML = '';
	}
}


function show_message(mId, hide) {

	if (hide == 0) {
		var ajax_content = ajax_file('ajax_show_messages.php?mId='+ mId);
		if (ajax_content) {

			document.getElementById("message_"+ mId).innerHTML = ajax_content;

			document.getElementById("message_"+ mId).onclick = '';
			document.getElementById("message_"+ mId).style.cursor = 'default';

		}
	} else {
	var ajax_content = ajax_file('ajax_show_messages.php?mId='+ mId + '&hide=1');
		if (ajax_content) {

			document.getElementById("message_" + mId).innerHTML = ajax_content;
		
			document.getElementById("message_" + mId).onclick = "show_message("+mId+",0);";
				
			document.getElementById("message_" + mId).style.cursor = 'pointer';

		}
	}
}

// On va regarde si des valeur ont ete modifiees dans les blocs de filtre (taille, couleur, promo)
// et si c'est le cas on peux faire de l'ajax
function changeFiltre( id, type_bloc, type, idObj, parentPath ) {
	
	if($('#'+type_bloc+'_'+id).attr('class') == '') {
		if( type_bloc == 'couleur' )
			tab_get_couleur.push(id);
		else if( type_bloc == 'taille' )
			tab_get_taille.push(id);
		else if( type_bloc == 'prix' )
			tab_get_price.push(id);
		$('#'+type_bloc+'_'+id).addClass('selected');
		$('#'+type_bloc+'_'+id+' span').addClass('selected');
		$('#'+type_bloc+'_'+id+' a').css('color','#FD6E0D');
	}
	else {
		if( type_bloc == 'couleur' )
			removeByValue(tab_get_couleur,id);
		else if( type_bloc == 'taille' )
			removeByValue(tab_get_taille,id);
		else if( type_bloc == 'prix' )
			removeByValue(tab_get_price,id);
		$('#'+type_bloc+'_'+id).removeAttr('class','');
		$('#'+type_bloc+'_'+id+' span').removeClass('selected');
		$('#'+type_bloc+'_'+id+' a').css('color','#616161');
	}
	
	generateNewBlocProd( type, idObj, parentPath );
	
}

// On va regarde si des valeur ont ete modifiees dans les blocs de filtre (taille, couleur, promo)
// et si c'est le cas on peux faire de l'ajax
function changeFiltreSearch( id, type_bloc, parameters, page, parentPath, nb_product ) {
	
	if($('#'+type_bloc+'_'+id).attr('class') == '') {
		if( type_bloc == 'couleur' )
			tab_get_couleur.push(id);
		else if( type_bloc == 'taille' )
			tab_get_taille.push(id);
		else if( type_bloc == 'prix' )
			tab_get_price.push(id);
		$('#'+type_bloc+'_'+id).addClass('selected');
		$('#'+type_bloc+'_'+id+' span').addClass('selected');
		$('#'+type_bloc+'_'+id+' a').css('color','#FD6E0D');
	}
	else {
		if( type_bloc == 'couleur' )
			removeByValue(tab_get_couleur,id);
		else if( type_bloc == 'taille' )
			removeByValue(tab_get_taille,id);
		else if( type_bloc == 'prix' )
			removeByValue(tab_get_price,id);
		$('#'+type_bloc+'_'+id).removeAttr('class','');
		$('#'+type_bloc+'_'+id+' span').removeClass('selected');
		$('#'+type_bloc+'_'+id+' a').css('color','#616161');
	}
	
	generateNewBlocSearch( parameters, page, parentPath, nb_product );
	
}

// On va regarde tout les bloc et on envoi l'ajax
// Pour les blocs de cases ? cocher
// Pour le slider des prix
// Pour le bouton qui supprime un element
function generateNewBlocProd( type, idObj, parentPath, page, nb_product ) {
	
	var is_from_page = false;
	
	// On check si l'utilisateur a clique sur la pagination ou le nombre de produit par page
	if(typeof(page) != 'undefined') {
		document.getElementById('page').value = page;
		is_from_page = true;
	}
	if(typeof(nb_product) != 'undefined') document.getElementById('nb_prod').value = nb_product;
	
	var str_taille = '';
	var str_couleur = '';
	var str_prix = '';
	var str_final = '';
	
	if( tab_get_taille.length > 0 ) str_taille = tab_get_taille.join('~');
	if( tab_get_couleur.length > 0 ) str_couleur = tab_get_couleur.join('~');
	if( tab_get_price.length > 0 ) str_prix = tab_get_price.join('~');
	
	str_final += '&taille=' + str_taille;
	str_final += '&couleur=' + str_couleur;
	str_final += '&prix=' + str_prix;
	str_final += '&tri=' + $("#triFiltre" ).val();
	
	if( page == 'all' ) {
		
		all_product = true;
		
	}
	
	if( all_product == true ) {
		
		pagecurrent = 0;
		
		if( document.getElementById('pagination_haut') )
			document.getElementById('pagination_haut').innerHTML = '';
		if( document.getElementById('pagination_bas') )
			document.getElementById('pagination_bas').innerHTML = '';
		
		if( page != 'all' ) {
		
			document.getElementById('scroll_items').innerHTML = '<p id="loading"><img style="margin-top:35px;margin-right:10px;" src="' + parentPath + 'img/loader.gif" /><br /><span>Chargement...</span></p>';
			var response = ajax_file(parentPath + 'ajax_reload_products.php?prix_spe=true&page=' + document.getElementById('page').value + '&type=' + type + '&parentPath=' + parentPath + '&idObj=' + idObj + '&nb_prod=' + document.getElementById('nb_prod').value + '&is_page=' + is_from_page + str_final );
			var tab_response = response.split('#');
			
			if( tab_response[0] != '' ) {
				
				var bloc_photo = tab_response[0];
				document.getElementById('scroll_items').innerHTML = bloc_photo;
				var nb_articles = tab_response[1];
				document.getElementById('nb_articles_top').innerHTML = nb_articles;
				document.getElementById('nb_articles_bot').innerHTML = nb_articles;
				
				var pluriel = (nb_articles == '1')? '':'s';
				
				document.getElementById('txt_nb_articles_top').innerHTML = 'article'+pluriel+' trouv&eacute;'+pluriel;
				document.getElementById('txt_nb_articles_bottom').innerHTML = 'article'+pluriel+' trouv&eacute;'+pluriel;
				
				nbPage = Math.ceil(nb_articles/15);
				
			}
			else {
			
				document.getElementById('scroll_items').innerHTML = ajax_file(parentPath + 'ajax_sprintf.php?arg1=no_response_search');
				
				document.getElementById('nb_articles_top').innerHTML = 0;
				document.getElementById('nb_articles_bot').innerHTML = 0;
				
				document.getElementById('txt_nb_articles_top').innerHTML = 'article trouv&eacute;';
				document.getElementById('txt_nb_articles_bottom').innerHTML = 'article trouv&eacute;';
				
				nbPage = 0;
			
			}
			
			current_url = parentPath + 'ajax_reload_products.php?all_product=true&prix_spe=true&page=' + pagecurrent + '&type=' + type + '&parentPath=' + parentPath + '&idObj=' + idObj + '&nb_prod=' + document.getElementById('nb_prod').value + '&is_page=true' + str_final;
		
		}
		else 
			current_url = '';
		
		$('#conteneur_photos').scrollExtend(
			{
			'target': 'div#scroll_items',
			'url': parentPath + 'ajax_reload_products.php?all_product=true&prix_spe=true&page=' + pagecurrent + '&type=' + type + '&parentPath=' + parentPath + '&idObj=' + idObj + '&nb_prod=' + document.getElementById('nb_prod').value + '&is_page=true' + str_final,
			'newElementClass': 'list_item more_content'
			}
		);
		
		
	}
	else {
	
		document.getElementById('scroll_items').innerHTML = '<p id="loading"><img style="margin-top:35px;margin-right:10px;" src="' + parentPath + 'img/loader.gif" /><br /><span>Chargement...</span></p>';
		var response = ajax_file(parentPath + 'ajax_reload_products.php?prix_spe=true&page=' + document.getElementById('page').value + '&type=' + type + '&parentPath=' + parentPath + '&idObj=' + idObj + '&nb_prod=' + document.getElementById('nb_prod').value + '&is_page=' + is_from_page + str_final );
		
		var tab_response = response.split('#');
		if( tab_response[0] != '' ) {
			
			var bloc_photo = tab_response[0];
			document.getElementById('scroll_items').innerHTML = bloc_photo;
			var nb_articles = tab_response[1];
			document.getElementById('nb_articles_top').innerHTML = nb_articles;
			document.getElementById('nb_articles_bot').innerHTML = nb_articles;
			
			var pluriel = (nb_articles == '1')? '':'s';
				
				document.getElementById('txt_nb_articles_top').innerHTML = 'article'+pluriel+' trouv&eacute;'+pluriel;
				document.getElementById('txt_nb_articles_bottom').innerHTML = 'article'+pluriel+' trouv&eacute;'+pluriel;
			
			var nav = tab_response[2];
			var nav_bas = tab_response[3];
			if( document.getElementById('pagination_haut') )
				document.getElementById('pagination_haut').innerHTML = nav;
			if( document.getElementById('pagination_bas') )
				document.getElementById('pagination_bas').innerHTML = nav_bas;
			
			var nb_prod = tab_response[4];
			document.getElementById('nb_prod').style.display = 'block';
			if(document.getElementById('nb_prod_numeric')) document.getElementById('nb_prod_numeric').innerHTML = nb_prod;
			
		}
		else {
			
			document.getElementById('scroll_items').innerHTML = ajax_file(parentPath + 'ajax_sprintf.php?arg1=no_response_search');
			
			if( document.getElementById('pagination_haut') )
				document.getElementById('pagination_haut').innerHTML = '';
			if( document.getElementById('pagination_bas') )
				document.getElementById('pagination_bas').innerHTML = '';
			
			document.getElementById('nb_articles_top').innerHTML = 0;
			document.getElementById('nb_articles_bot').innerHTML = 0;
			
			document.getElementById('txt_nb_articles_top').innerHTML = 'article trouv&eacute;';
			document.getElementById('txt_nb_articles_bottom').innerHTML = 'article trouv&eacute;';
		
		}
		
	}

}

//On va regarde tout les bloc et on envoi l'ajax
//Pour les blocs de cases ? cocher
//Pour le slider des prix
//Pour le bouton qui supprime un element
function generateNewBlocSearch( parameters, page, parentPath, nb_product ) {
	
	var is_from_page = false;
	
	// On check si l'utilisateur a clique sur la pagination ou le nombre de produit par page
	if(typeof(page) != 'undefined') {
		document.getElementById('page').value = page;
		is_from_page = true;
	}
	if(typeof(nb_product) != 'undefined') document.getElementById('nb_prod').value = nb_product;
	
	var str_taille = '';
	var str_couleur = '';
	var str_prix = '';
	var str_final = parameters;
	
	if( tab_get_taille.length > 0 ) str_taille = tab_get_taille.join('~');
	if( tab_get_couleur.length > 0 ) str_couleur = tab_get_couleur.join('~');
	if( tab_get_price.length > 0 ) str_prix = tab_get_price.join('~');
	
	str_final += '&taille=' + str_taille;
	str_final += '&couleur=' + str_couleur;
	str_final += '&prix=' + str_prix;
	str_final += '&tri=' + $("#triFiltre" ).val();
	
	if( page == 'all' ) {
		
		all_product = true;
		
	}
	
	if( all_product == true ) {
		
		pagecurrent = 0;
		
		document.getElementById('pagination_haut').innerHTML = '';
		document.getElementById('pagination_bas').innerHTML = '';
		
		if( page != 'all' ) {
			
			document.getElementById('scroll_items').innerHTML = '<p id="loading"><img style="margin-top:35px;margin-right:10px;" src="' + parentPath + 'img/loader.gif" /><br /><span>Chargement...</span></p>';
			var response = ajax_file(parentPath + 'ajax_reload_search.php?all_product=true&prix_spe=true&' + str_final + '&is_page=' + is_from_page + '&parentPath=' + parentPath + '&nbProducts='+nb_product + '&page=' + document.getElementById('page').value );
			var tab_response = response.split('#');
			
			if( tab_response[0] != '' ) {
				
				var bloc_photo = tab_response[0];
				document.getElementById('scroll_items').innerHTML = bloc_photo;
				var nb_articles = tab_response[1];
				document.getElementById('nb_articles_top').innerHTML = nb_articles;
				document.getElementById('nb_articles_bot').innerHTML = nb_articles;
				
				var pluriel = (nb_articles == '1')? '':'s';
				
				document.getElementById('txt_nb_articles_top').innerHTML = 'article'+pluriel+' trouv&eacute;'+pluriel;
				document.getElementById('txt_nb_articles_bottom').innerHTML = 'article'+pluriel+' trouv&eacute;'+pluriel;
				
				nbPage = Math.ceil(nb_articles/15);
				
			}
			else {
			
				document.getElementById('scroll_items').innerHTML = ajax_file(parentPath + 'ajax_sprintf.php?arg1=no_response_search');
				
				document.getElementById('nb_articles_top').innerHTML = 0;
				document.getElementById('nb_articles_bot').innerHTML = 0;
				
				document.getElementById('txt_nb_articles_top').innerHTML = 'article trouv&eacute;';
				document.getElementById('txt_nb_articles_bottom').innerHTML = 'article trouv&eacute;';
				
				nbPage = 0;
			
			}
			
			current_url = parentPath + 'ajax_reload_search.php?all_product=true&prix_spe=true&' + str_final + '&is_page=' + is_from_page + '&parentPath=' + parentPath + '&nbProducts='+nb_product + '&page=' + pagecurrent;
		
		}
		else
			current_url = '';
		
		$('#conteneur_photos').scrollExtend(
			{
			'target': 'div#scroll_items',
			'url': parentPath + 'ajax_reload_search.php?all_product=true&prix_spe=true&' + str_final + '&is_page=' + is_from_page + '&parentPath=' + parentPath + '&nbProducts='+nb_product + '&page=' + pagecurrent,
			'newElementClass': 'list_item more_content'
			}
		);
		
	}
	else {
	
		document.getElementById('scroll_items').innerHTML = '<p id="loading"><img style="margin-top:35px;margin-right:10px;" src="' + parentPath + 'img/loader.gif" /><br /><span>Chargement...</span></p>';
		var response = ajax_file(parentPath + 'ajax_reload_search.php?prix_spe=true&' + str_final + '&is_page=' + is_from_page + '&parentPath=' + parentPath + '&nbProducts='+nb_product + '&page=' + document.getElementById('page').value );
		
		var tab_response = response.split('#');
		if( tab_response[0] != '' ) {
			
			var bloc_photo = tab_response[0];
			document.getElementById('scroll_items').innerHTML = bloc_photo;
			var nb_articles = tab_response[1];
			document.getElementById('nb_articles_top').innerHTML = nb_articles;
			document.getElementById('nb_articles_bot').innerHTML = nb_articles;
			
			var pluriel = (nb_articles == '1')? '':'s';
				
			document.getElementById('txt_nb_articles_top').innerHTML = 'article'+pluriel+' trouv&eacute;'+pluriel;
			document.getElementById('txt_nb_articles_bottom').innerHTML = 'article'+pluriel+' trouv&eacute;'+pluriel;
			
			var nav = tab_response[2];
			var nav_bas = tab_response[3];
			if( document.getElementById('pagination_haut') )
				document.getElementById('pagination_haut').innerHTML = nav;
			if( document.getElementById('pagination_bas') )
				document.getElementById('pagination_bas').innerHTML = nav_bas;
			
			var nb_prod = tab_response[4];
			if(document.getElementById('nb_prod_numeric')) document.getElementById('nb_prod_numeric').innerHTML = nb_prod;
			
		}
		else {
			
			document.getElementById('scroll_items').innerHTML = ajax_file(parentPath + 'ajax_sprintf.php?arg1=no_response_search');
			
			if( document.getElementById('pagination_haut') )
				document.getElementById('pagination_haut').innerHTML = '';
			if( document.getElementById('pagination_bas') )
				document.getElementById('pagination_bas').innerHTML = '';
			
			document.getElementById('nb_articles_top').innerHTML = 0;
			document.getElementById('nb_articles_bot').innerHTML = 0;
			
			document.getElementById('txt_nb_articles_top').innerHTML = 'article trouv&eacute;';
			document.getElementById('txt_nb_articles_bottom').innerHTML = 'article trouv&eacute;';
			
		}
		
	}
	
}

// Affiche la liste des commandes selon le type
function show_orders_by_type(elementID, type, parentPath) {
	
	// Gestion de la surbrillance des onglets
	var tab_onglet = new Array('cmdEnCours','cmdExpediee','cmdRetournee','cmdAnnulee');
	
	for( var i=0 ; i<4 ; i++ ) {
	
		if( document.getElementById('onglet_'+tab_onglet) && type == (i+1) )
			$('#onglet_'+tab_onglet).addClass('actif');
		else if( document.getElementById('onglet_'+tab_onglet) )
			$('#onglet_'+tab_onglet).removeClass('actif');
	
	}
	
	var container = document.getElementById(elementID);

	//clearTimeout(time_out);
	if (container) {
		var response = ajax_file(parentPath + 'ajax_account_orders_by_type.php?type=' + type);
		
		if (response)
			container.innerHTML = response;
		else
			container.innerHTML = '';
	}
}


// Permet le non rafraichissement d'une page en exploitant l'objet XHR
function	ajax_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);
}
// --------------------------------------------------------------------------------

////////ajax_deconnect////////
function ajaxDeconnect(path_relative_root) {

	response = ajax_file( path_relative_root + 'ajax_deconnect.php' );
	
	// On regarde d'abord dans quelle page on se trouve
	var url = window.location.pathname;
	var index_deb = url.lastIndexOf('/');
	var index_fin = url.lastIndexOf('.');
	var provenance = url.substring(index_deb+1,index_fin);
	
	// Et on redirige si on est dans des pages en relation avec le compte client
	if( provenance == 'adresses' || provenance == 'mes_infos' || provenance == 'newsletter' || provenance == 'parrainage' || provenance == 'mon-compte' || provenance == 'facture-liste' || provenance == 'avoir-liste' || provenance == 'commande_detail' || provenance == 'panier' || provenance == 'livraison-kiala' || provenance == 'livraison' || provenance == 'paiement' || provenance == 'banque' || provenance == 'erreur_cmd' || provenance == 'erreur_commande' || provenance == 'banque_refus' || provenance == 'remerciements' )
		window.location.href = path_relative_root + 'connexion.php';
	else {
		if( response == 'true' ) {
			
			//document.getElementById('topMenuConnexionTop').innerHTML = '<img style="margin-left:89px;margin-top:61px;float:left;" src="'+path_relative_root+'img/loader.gif" /><p style="float:left;margin-left:10px;margin-top:64px;"><strong>Deconnexion...</strong></p>';
			
			var str_return = '<table cellspacing="0" cellpadding="0" border="0" id="bloc_login_top" class="connexion_top_table">';
			str_return += '<form method="post" name="auth" onsubmit="return false;" onblur="openConnexionTop();">';
			str_return += '<input name="caid" value="" type="hidden" />';							
			str_return += '<input name="act" value="ident" type="hidden" />';
			str_return += '<tbody><tr><td colspan="2" height="15"></td></tr>';
			str_return += '<tr>';
			str_return += '<td height="25" id="clientMailAuthTopLabel" class="right" >E-mail : </td>';
			str_return += '<td height="25">';
			str_return += '<input onblur="checkForm(\'mail\',this,\'login_email\',null, 1);" name="userbdd" id="clientMailAuthTop" value="" class="inputFormSite" style="width: 192px;" type="text" />';
			str_return += '</td>';
			str_return += '</tr>';
			str_return += '<tr>';
			str_return += '<td height="25" id="clientPwdAuthTopLabel" class="right">Mot de passe : </td>';
			str_return += '<td height="25"><input onblur="checkForm(\'alphanum\',this,\'login_mdp\',null, 1)" name="passbdd" id="clientPwdAuthTop" value="" class="inputFormSite" style="width: 192px;" type="password" /></td>';
			str_return += '</tr>';
			str_return += '<tr>';
			str_return += '<td height="25">&nbsp;</td>';
			str_return += '<td height="25" id="btn_identification_top"><input id="btn-top-login" onclick="waitingProcess(this,\'loader_5\',0)" name="Identification" class="input_orange f_right" value="VALIDER" type="submit" style="height:28px;line-height:28px;" /><div class="f_right" id="loader_5" style="display:none;margin:0 6px 0 0;height:28px;"><img style="height:28px;" src="'+path_relative_root+'img/loader.gif" /></div></td>';
			str_return += '</tr>';
			str_return += '<tr class="cache" id="clientMailAuthTopErr">';
			str_return += '<td colspan="2" height="25">';
			str_return += '<p style="color:#ff0000;padding:0 0 0 15px;">';
			str_return += '<span class="picto_erreur_bloc_connexion"><img style="height:16px;" alt="erreur" src="' + path_relative_root + 'img/picto_panneau.png" /></span>';
			str_return += 'L\'adresse e-mail est invalide.';
			str_return += '</p>';
			str_return += '</td>';
			str_return += '</tr>';
			str_return += '<tr class="cache" id="clientPwdAuthTopErr">';
			str_return += '<td colspan="2" height="25">';
			str_return += '<p style="color:#ff0000;padding:0 0 0 15px;">';
			str_return += '<span class="picto_erreur_bloc_connexion"><img style="height:16px;" alt="erreur" src="' + path_relative_root + 'img/picto_panneau.png" /></span>';
			str_return += 'Le mot de passe doit faire au moins 3 caractères.';
			str_return += '</p>';
			str_return += '</td>';
			str_return += '</tr>';
			str_return += '<tr class="cache" id="AuthTopErr">';
			str_return += '<td colspan="2" height="25">';
			str_return += '<p style="color:#ff0000;padding:0 0 0 15px;">';
			str_return += '<span class="picto_erreur_bloc_connexion"><img style="height:16px;" alt="erreur" src="' + path_relative_root + 'img/picto_panneau.png" /></span>';
			str_return += 'Les identifiants sont incorrectes.';
			str_return += '</p>';
			str_return += '</td>';
			str_return += '</tr>';
			str_return += '<tr id="lost_password_top">';
			str_return += '<td></td>';
			str_return += '<td height="25">';
			str_return += '<a href="javascript:;" onclick="afficheLostPasswordTop();">Mot de passe oublié ?</a>';
			str_return += '</td>';
			str_return += '</tr>';
			str_return += '<tr><td colspan="2" height="10"></td></tr>';
			str_return += '<tr class="inscription_connexion_top"><td colspan="2"><span class="f_left">JE NE SUIS PAS ENCORE CLIENT(E) ?</span> <a style="margin:0 4px 0 0;color:#fd6d0c;text-decoration:underline;text-transform:none;" href="'+path_relative_root+'connexion.php" class="f_right">Inscrivez vous</a>';
			str_return += '</td>';
			str_return += '</tr>';
			str_return += '</tbody>';
			str_return += '</form>';
			str_return += '</table>';
			str_return += '<table width="100%" border="0" cellpadding="0" cellspacing="0" id="bloc_lost_password_top" class="cache">';
			str_return += '<form method="post" name="lostpwd" onsubmit="return false;" action="">';
			str_return += '<tr><td colspan="2"><p>RECEVEZ VOTRE MOT DE PASSE :</p></td></tr>';
			str_return += '<input name="act" value="new mdp link" type="hidden" />';
			str_return += '<tr id="lostpwdTopSucces1">';
			str_return += '<td id="mailLostTopLabel" width="83">E-mail :&nbsp;</td>';
			str_return += '<td align="left"><input onblur="checkForm(\'mail\',this,\'login_email\',null, 1);" id="mailLostTop" name="email" value="" class="inputFormSite" type="text" /></td>';
			str_return += '</tr>';
			str_return += '<tr id="lostpwdTopSucces2">';
			str_return += '<td></td><td style="padding:10px 0 0 0;" align="left">';
			str_return += '<input style="margin:0 18px 0 0;height:28px;line-height:28px;" class="input_gray f_right" name="annuler" value="ANNULER" type="button" onclick="reloadBlocLoginTop();" /><input style="margin:0 6px 0 5px;height:28px;line-height:28px;" id="btn-top-pwdlost" class="input_orange f_right" name="envoyer" value="ENVOYER" type="submit" onclick="waitingProcess(this,\'loader_7\',1);" /><div style="display:none;height:28px;" id="loader_7" class="f_right"><img style="height:28px;" src="'+path_relative_root+'img/loader.gif" /></div>';
			str_return += '</td>';
			str_return += '</tr><tr><td colspan="2" height="10"></td></tr>';
			str_return += '<tr id="lostpwdTopSucces3" style="display:none;">';
			str_return += '<td colspan="2">';
			str_return += '<p>Un e-mail vous a bien été envoyé.<br />Il vous permettra de choisir votre nouveau<br /> mot de passe.</p>';
			str_return += '</td>';
			str_return += '</tr>';
			str_return += '<tr id="lostpwdTopSucces4" style="display:none;">';
			str_return += '<td>&nbsp;</td><td></td>';
			str_return += '</tr>';
			str_return += '<tr class="cache" id="mailLostTopErr">';
			str_return += '<td colspan="2">';
			str_return += '<p style="color:#ff0000;padding:0 0 5px 15px;font-size:11px;">';
			str_return += '<span class="picto_erreur_bloc_connexion"><img style="height:16px;" alt="erreur" src="' + path_relative_root + 'img/picto_panneau.png" /></span>';
			str_return += 'L\'adresse e-mail est invalide.';
			str_return += '</p>';
			str_return += '</td>';
			str_return += '</tr>';
			str_return += '<tr class="cache" id="lostpwdTopErr">';
			str_return += '<td colspan="2">';
			str_return += '<p style="color:#ff0000;padding:0 0 5px 15px;font-size:11px;">';
			str_return += '<span class="picto_erreur_bloc_connexion"><img style="height:16px;" alt="erreur" src="' + path_relative_root + 'img/picto_panneau.png" /></span>';
			str_return += 'Vous n\'êtes pas enregistré, veuillez vous inscrire.';
			str_return += '</p>';
			str_return += '</td>';
			str_return += '</tr>';
			str_return += '</form><tr><td colspan="2" height="10"></td></tr><tr class="inscription_connexion_top"><td colspan="2"><span class="f_left">JE NE SUIS PAS ENCORE CLIENT(E) ?</span> <a style="margin:0 4px 0 0;color:#fd6d0c;text-decoration:underline;text-transform:none;" href="'+path_relative_root+'connexion.php" class="f_right">Inscrivez vous</a></td></tr>';
			str_return += '<td></td></table>';
			
			document.getElementById('connexion_top').innerHTML = str_return;
			//document.getElementById('entete_connexion').innerHTML = ' Connexion  ';
			//document.getElementById('lien_mon_compte').href = path_relative_root + 'connexion.php';
		
		}
		
	}
	hideLoader();
}
////////
