//AJAX
var xhr = null; 

function openCloseDiv(divId){
	if(divId != ''){
		if(div = document.getElementById(divId)){
			if(div.style.display == "none"){
				div.style.display = "block";
			}else{
				div.style.display = "none";
			}
		}
	}
}

function getXhr(){ 
	if(window.XMLHttpRequest) xhr = new XMLHttpRequest(); 
	else if(window.ActiveXObject) { 
		try {
			xhr = new ActiveXObject("Msxml2.XMLHTTP"); 
		} catch (e) {
			xhr = new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
	} else { 
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest, veuillez le mettre a jour"); 
		xhr = false; 
	} 
}

function setCritere(sCritereName, sCritereValue, oCallElement){
  // BGN ABO Suppression Etape Finition - 25/03/2010
  // On supprime l'étape du choix de la finition
	//aListeBlocs = ['bloc_ct_parent','bloc_finition','bloc_couleur','bloc_reference'];
	// END ABO Suppression Etape Finition - 25/03/2010
	aListeBlocs = ['bloc_ct_parent','bloc_couleur','bloc_reference'];
	iEntree = aListeBlocs.length;

	switch(sCritereName){
		case 'prod_taille':
			oObjetAChanger = false;
			iEntree = 0;
			break;
		case 'prod_ct':
			oObjetAChanger = oCallElement;
			sClassName = 'caracteristiques_techniques';
			iEntree = 1;
			break;
		/* BGN ABO Suppression Etape Finition - 25/03/2010
    case 'prod_ct_finition':
			oObjetAChanger = false;
			iEntree = 2;
			break;
    END ABO Suppression Etape Finition - 25/03/2010 */
		case 'prod_ct_couleur':
			oObjetAChanger = oCallElement.parentNode.parentNode;
			sClassName = 'couleur';
			// BGN ABO Suppression Etape Finition - 25/03/2010
			//iEntree = 3;
			// END ABO Suppression Etape Finition - 25/03/2010
			iEntree = 2;
			break;
		case 'prod_reference_selection':
			oObjetAChanger = oCallElement;
			sClassName = 'reference';
			break;
		default:
			oObjetAChanger = false;
			break;
	}
	
	getXhr();
	xhr.onreadystatechange = function() { 
		if(xhr.readyState == 4 && xhr.status == 200) {
			if(xhr.responseText != ''){

				aReponse = xhr.responseText.split('###SEPARATEUR###');
				//alert(aReponse);
				if(oTbodyReferences = document.getElementById('tbody_references')){
					if(aReponse[0] != ''){
						oTbodyReferences.innerHTML = aReponse[0];
					}
				}

				if(oBlocCaracs = document.getElementById('bloc_ct')){
					if(aReponse[1] != ''){
						oBlocCaracs.innerHTML = aReponse[1] + '<div class="sepH1">&nbsp;</div>';
					}
				}

				if(oBlocCouleurs = document.getElementById('bloc_couleurs')){
					if(aReponse[2] != ''){
						oBlocCouleurs.innerHTML = aReponse[2] + '<div class="sepH1">&nbsp;</div>';
					}
				}
        
        /*
        BGN ABO Suppression Etape Finition - 25/03/2010
				// La liste déroulante du choix de la finition n'apparait plus
				// On n'a donc plus besoin de faire ce traitement
        if(oSelectFinition = document.getElementById('select_finition')){
					if(aReponse[3] != ''){
						aListeOptions = aReponse[3].split('|');
						while(oSelectFinition.options.length > 0){
							oSelectFinition.options[oSelectFinition.options.length-1] = null;
						}
						oOption = new Option('-','-',false,true);
						oSelectFinition.options[oSelectFinition.options.length] = oOption;
						for (iCptOption = 0; iCptOption < aListeOptions.length; iCptOption ++){
							aOptionCourante = aListeOptions[iCptOption].split(',');
							oOption = new Option(aOptionCourante[0],aOptionCourante[1],false,false);
							oSelectFinition.options[oSelectFinition.options.length] = oOption;
						}
					}
				}
        END ABO Suppression Etape Finition - 25/03/2010
        */

				/*if(oBlocTelechargerCourbesPhoto = document.getElementById('bloc_telecharger_courbes_photo')){
					if(aReponse[4] != ''){
						oBlocTelechargerCourbesPhoto.innerHTML = aReponse[4];
					}
				}*/
				// BGN ABO Suppression Etape Finition - 25/03/2010
				if(''+aReponse[4]+'' != '' && typeof(aReponse[4]) != 'undefined'){
				  if(aReponse[4].indexOf('<div class="documents_techniques_item_fichier"></div>') == -1){  // nom fichier non vide : afficher la div
  					if( oBlocTelechargerCourbesPhoto = document.getElementById('bloc_telecharger_courbes_photo') ){
  						oBlocTelechargerCourbesPhoto.innerHTML = aReponse[4];
  						oBlocTelechargerCourbesPhoto.className = oBlocTelechargerCourbesPhoto.className.replace('cachee','visible');
  					}
					}else{
            if( oBlocTelechargerCourbesPhoto = document.getElementById('bloc_telecharger_courbes_photo') ){
  						oBlocTelechargerCourbesPhoto.className = oBlocTelechargerCourbesPhoto.className.replace('visible','cachee');
  					}
          }
				}else{
          if( oBlocTelechargerCourbesPhoto = document.getElementById('bloc_telecharger_courbes_photo') ){
						oBlocTelechargerCourbesPhoto.className = oBlocTelechargerCourbesPhoto.className.replace('visible','cachee');
					}
        }
        // END ABO Suppression Etape Finition - 25/03/2010

				if(oSpanContenuPrix = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_prix_produit_prix')){
					if(aReponse[5] != ''){
						oSpanContenuPrix.innerHTML = aReponse[5];
					}
				}
				
				if(oDivFlash = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_prix_produit')){
					if(aReponse[5] != ''){
						oDivFlash.className = oDivFlash.className.replace('cachee','visible');
					}else{
						oDivFlash.className = oDivFlash.className.replace('visible','cachee');
					}
				}
				
				if(oDivContenuPictos = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_liste_picto')){
					if(aReponse[6] != ''){
						oListePictos = oDivContenuPictos.getElementsByTagName('img');
						// BGN la reponse est envoyee a l'envers : retourner la chaine
						splitext = aReponse[6].split("");
						revertext = splitext.reverse();
						aReponse[6] = revertext.join("");
						// END la reponse est envoyee a l'envers : retourner la chaine
						for(iCptPicto = aReponse[6].length - 1;iCptPicto >= 0;iCptPicto-- ){
							if(aReponse[6].charAt(iCptPicto) == 1){
								oListePictos[iCptPicto].src = oListePictos[iCptPicto].src.replace('_off','_on');
							}else{
								oListePictos[iCptPicto].src = oListePictos[iCptPicto].src.replace('_on','_off');
							}
						}
						oDivContenuPictos.className = oDivContenuPictos.className.replace('cachee','visible');
					}else{
						oDivContenuPictos.className = oDivContenuPictos.className.replace('visible','cachee');
					}
				}
				
				// BGN MHA : l'icone 'nouveau' n'est affiche qu'a la selection de la reference
				if( oDivContenantProduitNouveau = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_nouveau')){
					oDivContenantProduitNouveau.innerHTML = '';
					oDivContenantProduitNouveau.className = oDivContenantProduitNouveau.className.replace('visible','cachee');
				}
				// END MHA : l'icone 'nouveau' n'est affiche qu'a la selection de la reference

				if(aReponse[7] != ''){
					aListeImages = aReponse[7].split('|');
					if(aListeImages.length == 5){
						if( (oVisContenantVisuelAmbiance = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_visuel_ambiance')) && (aListeImages[0] != '') ){
							oVisContenantVisuelAmbiance.innerHTML = '<img src="'+aListeImages[0]+'" alt="" title="" />';
							oVisContenantVisuelAmbiance.className = oVisContenantVisuelAmbiance.className.replace('cachee','visible');
						}
						if( (oDivContenantVisuelsTechniques1 = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_visuel_technique_1')) && (aListeImages[1] != '') ){
							oDivContenantVisuelsTechniques1.innerHTML = '<img src="'+aListeImages[1]+'" alt="" title="" />';
							oDivContenantVisuelsTechniques1.className = oDivContenantVisuelsTechniques1.className.replace('cachee','visible');
						}
						if( (oDivContenantVisuelsTechniques2 = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_visuel_technique_2')) && (aListeImages[2] != '') ){
							oDivContenantVisuelsTechniques2.innerHTML = '<img src="'+aListeImages[2]+'" alt="" title="" />';
							oDivContenantVisuelsTechniques2.className = oDivContenantVisuelsTechniques2.className.replace('cachee','visible');
						}
						if( (oDivContenantVisuelsProduit = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_visuel_produit')) && (aListeImages[3] != '') ){
							oDivContenantVisuelsProduit.innerHTML = '<img src="'+aListeImages[3]+'" alt="" title="" />';
							oDivContenantVisuelsProduit.className = oDivContenantVisuelsProduit.className.replace('cachee','visible');
						}
						if( (oDivContenantProduitNouveau = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_nouveau')) && (aListeImages[4] != '') ){
							oDivContenantProduitNouveau.innerHTML = '<img src="'+aListeImages[4]+'" alt="" title="" />';
							oDivContenantProduitNouveau.className = oDivContenantProduitNouveau.className.replace('cachee','visible');
						}else{
							if( oDivContenantProduitNouveau = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_nouveau')){
								oDivContenantProduitNouveau.innerHTML = '';
								oDivContenantProduitNouveau.className = oDivContenantProduitNouveau.className.replace('cachee','visible');
							}
						}
					}else{
						if(oDivContenantVisuelsTechniques = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_visuel_technique')){
							oDivContenantVisuelsTechniques.className = oDivContenantVisuelsTechniques.className.replace('visible','cachee');
						}
						if(oVisContenantVisuelAmbiance = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_visuel_ambiance')){
							oVisContenantVisuelAmbiance.className = oVisContenantVisuelAmbiance.className.replace('visible','cachee');
						}
					}
				}else{
					if(oDivContenantVisuelsTechniques1 = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_visuel_technique_1')){
						oDivContenantVisuelsTechniques1.className = oDivContenantVisuelsTechniques1.className.replace('visible','cachee');
					}
					if(oDivContenantVisuelsTechniques2 = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_visuel_technique_2')){
						oDivContenantVisuelsTechniques2.className = oDivContenantVisuelsTechniques2.className.replace('visible','cachee');
					}
					if(oVisContenantVisuelAmbiance = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_visuel_ambiance')){
						oVisContenantVisuelAmbiance.className = oVisContenantVisuelAmbiance.className.replace('visible','cachee');
					}
					/*
					if( (oDivContenantVisuelsProduit = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_visuel_produit') ){
						oDivContenantVisuelsProduit.className = oDivContenantVisuelsProduit.className.replace('visible','cachee');
					}
					*/
				}

				// cadre normatif
				if( (oDivConteneurTexteNormatif = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_cadre_normatif_texte')) && (oDivConteneurNormatif = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_cadre_normatif')) ){
					if(aReponse[8] != ''){
						oDivConteneurTexteNormatif.innerHTML = aReponse[8];
						oDivConteneurNormatif.className = oDivConteneurNormatif.className.replace('cachee','visible');
					}else{
						oDivConteneurNormatif.className = oDivConteneurNormatif.className.replace('visible','cachee');
					}
				}

				// facilite
				if(''+aReponse[9]+'' != '' && typeof(aReponse[9]) != 'undefined'){
					if( (oDivConteneurTexteFacilite = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_facilite_texte')) && (oDivConteneurFacilite = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_facilite')) ){
						oDivConteneurTexteFacilite.innerHTML = aReponse[9];
						oDivConteneurFacilite.className = oDivConteneurFacilite.className.replace('cachee','visible');
					}
				}else{
					if( (oDivConteneurTexteFacilite = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_facilite_texte')) && (oDivConteneurFacilite = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_facilite')) ){
						oDivConteneurFacilite.className = oDivConteneurFacilite.className.replace('visible','cachee');
					}
				}

				// caracteristiques
				if(''+aReponse[10]+'' != '' && typeof(aReponse[10]) != 'undefined'){
					if( (oDivConteneurTexteCarac = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_caracteristique_texte')) && (oDivConteneurCarac = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_caracteristique')) ){
						oDivConteneurTexteCarac.innerHTML = aReponse[10];
						oDivConteneurCarac.className = oDivConteneurCarac.className.replace('cachee','visible');
					}
				}else{
					if( (oDivConteneurTexteCarac = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_caracteristique_texte')) && (oDivConteneurCarac = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_caracteristique')) ){
						oDivConteneurCarac.className = oDivConteneurCarac.className.replace('visible','cachee');
					}
				}

				// personnalisation
				if(''+aReponse[11]+'' != '' && typeof(aReponse[11]) != 'undefined'){
					if( (oDivConteneurTextePerso = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_personnalisation_texte')) && (oDivConteneurPerso = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_personnalisation')) ){
						oDivConteneurTextePerso.innerHTML = aReponse[11];
						oDivConteneurPerso.className = oDivConteneurPerso.className.replace('cachee','visible');
					}
				}else{
					if( (oDivConteneurTextePerso = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_personnalisation_texte')) && (oDivConteneurPerso = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_personnalisation')) ){
						oDivConteneurPerso.className = oDivConteneurPerso.className.replace('visible','cachee');
					}
				}

				// astuces
				if(''+aReponse[12]+'' != '' && typeof(aReponse[12]) != 'undefined'){
					if( (oDivConteneurTexteAstuces = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_astuces_texte')) && (oDivConteneurAstuces = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_astuces')) ){
						oDivConteneurTexteAstuces.innerHTML = aReponse[12];
						oDivConteneurAstuces.className = oDivConteneurAstuces.className.replace('cachee','visible');
						oDivConteneurAstuces.style.display = '';
					}
				}else{
					if( (oDivConteneurTexteAstuces = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_astuces_texte')) && (oDivConteneurAstuces = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_astuces')) ){
						oDivConteneurTexteAstuces.innerHTML = '';
						oDivConteneurAstuces.className = oDivConteneurAstuces.className.replace('visible','cachee');
						oDivConteneurAstuces.style.display = 'none';
					}
				}

				// Fiche technique
				/*if(''+aReponse[13]+'' != '' && typeof(aReponse[13]) != 'undefined'){
					if( oDivConteneurTexteFicheTechnique = document.getElementById('bloc_telecharger_fiche_technique') ){
						oDivConteneurTexteFicheTechnique.innerHTML = aReponse[13];
					}
				}*/
				// BGN ABO Suppression Etape Finition - 25/03/2010
				if(''+aReponse[13]+'' != '' && typeof(aReponse[13]) != 'undefined'){
				  if(aReponse[13].indexOf('<div class="documents_techniques_item_fichier"></div>') == -1){  // nom fichier non vide : afficher la div
  					if( oDivConteneurTexteFicheTechnique = document.getElementById('bloc_telecharger_fiche_technique') ){
  						oDivConteneurTexteFicheTechnique.innerHTML = aReponse[13];
  						oDivConteneurTexteFicheTechnique.className = oDivConteneurTexteFicheTechnique.className.replace('cachee','visible');
  					}
					}else{
            if( oDivConteneurTexteFicheTechnique = document.getElementById('bloc_telecharger_fiche_technique') ){
  						oDivConteneurTexteFicheTechnique.className = oDivConteneurTexteFicheTechnique.className.replace('visible','cachee');
  					}
          }
				}else{
          if( oDivConteneurTexteFicheTechnique = document.getElementById('bloc_telecharger_fiche_technique') ){
						oDivConteneurTexteFicheTechnique.className = oDivConteneurTexteFicheTechnique.className.replace('visible','cachee');
					}
        }
        // END ABO Suppression Etape Finition - 25/03/2010
        
        // BGN ABO Ajout lien video - 03/06/2010
        if(''+aReponse[14]+'' != '' && typeof(aReponse[14]) != 'undefined'){
				  if(aReponse[14].indexOf('<div class="documents_techniques_item_fichier"></div>') == -1){  // nom fichier non vide : afficher la div
  					if( oDivConteneurTexteVideo = document.getElementById('bloc_telecharger_fiche_video') ){
  						oDivConteneurTexteVideo.innerHTML = aReponse[14];
  						oDivConteneurTexteVideo.className = oDivConteneurTexteVideo.className.replace('cachee','visible');
  					}
					}else{
            if( oDivConteneurTexteVideo = document.getElementById('bloc_telecharger_fiche_video') ){
  						oDivConteneurTexteVideo.className = oDivConteneurTexteVideo.className.replace('visible','cachee');
  					}
          }
				}else{
          if( oDivConteneurTexteVideo  = document.getElementById('bloc_telecharger_fiche_video') ){
						oDivConteneurTexteVideo.className = oDivConteneurTexteVideo.className.replace('visible','cachee');
					}
        }
        // END ABO Ajout lien video - 03/06/2010

				// Fiche notice
				/*if(''+aReponse[15]+'' != '' && typeof(aReponse[15]) != 'undefined'){
					if( oDivConteneurTexteFicheNotice = document.getElementById('bloc_telecharger_fiche_notice') ){
						oDivConteneurTexteFicheNotice.innerHTML = aReponse[15];
					}
				}*/
				// BGN ABO Suppression Etape Finition - 25/03/2010
				if(''+aReponse[15]+'' != '' && typeof(aReponse[15]) != 'undefined'){
				  if(aReponse[15].indexOf('<div class="documents_techniques_item_fichier"></div>') == -1){  // nom fichier non vide : afficher la div
  					if( oDivConteneurTexteFicheNotice = document.getElementById('bloc_telecharger_fiche_notice') ){
  						oDivConteneurTexteFicheNotice.innerHTML = aReponse[15];
  						oDivConteneurTexteFicheNotice.className = oDivConteneurTexteFicheNotice.className.replace('cachee','visible');
  					}
					}else{
            if( oDivConteneurTexteFicheNotice = document.getElementById('bloc_telecharger_fiche_notice') ){
  						oDivConteneurTexteFicheNotice.className = oDivConteneurTexteFicheNotice.className.replace('visible','cachee');
  					}
          }
				}else{
          if( oDivConteneurTexteFicheNotice = document.getElementById('bloc_telecharger_fiche_technique') ){
						oDivConteneurTexteFicheNotice.className = oDivConteneurTexteFicheNotice.className.replace('visible','cachee');
					}
        }
        // BGN END Suppression Etape Finition - 25/03/2010

				// Fiche certificats
				//console.log(aReponse[16]);
				//console.log(aReponse[16].indexOf('<div class="documents_techniques_item_fichier"></div>'));
				// BGN ABO Suppression Etape Finition - 25/03/2010
				if(''+aReponse[16]+'' != '' && typeof(aReponse[16]) != 'undefined'){
				  if(aReponse[16].indexOf('<div class="documents_techniques_item_fichier"></div>') == -1){  // nom fichier non vide : afficher la div
  					if( oDivConteneurTexteCertificats = document.getElementById('bloc_telecharger_fiche_certificats') ){
  						oDivConteneurTexteCertificats.innerHTML = aReponse[16];
  						oDivConteneurTexteCertificats.className = oDivConteneurTexteCertificats.className.replace('cachee','visible');
  					}
					}else{
            if( oDivConteneurTexteCertificats = document.getElementById('bloc_telecharger_fiche_certificats') ){
  						oDivConteneurTexteCertificats.className = oDivConteneurTexteCertificats.className.replace('visible','cachee');
  					}
          }
				}else{
          if( oDivConteneurTexteCertificats = document.getElementById('bloc_telecharger_fiche_certificats') ){
						oDivConteneurTexteCertificats.className = oDivConteneurTexteCertificats.className.replace('visible','cachee');
					}
        }
        // END ABO Suppression Etape Finition - 25/03/2010
				
				// Fiche PEP
				/*if(''+aReponse[19]+'' != '' && typeof(aReponse[19]) != 'undefined'){
					if( oDivConteneurTextePep = document.getElementById('bloc_telecharger_fiche_pep') ){
						oDivConteneurTextePep.innerHTML = aReponse[19];
					}
				}*/
				// BGN ABO Suppression Etape Finition - 25/03/2010
				if(''+aReponse[19]+'' != '' && typeof(aReponse[19]) != 'undefined'){
				  if(aReponse[19].indexOf('<div class="documents_techniques_item_fichier"></div>') == -1){  // nom fichier non vide : afficher la div
  					if( oDivConteneurTextePep = document.getElementById('bloc_telecharger_fiche_pep') ){
  						oDivConteneurTextePep.innerHTML = aReponse[19];
  						oDivConteneurTextePep.className = oDivConteneurTextePep.className.replace('cachee','visible');
  					}
					}else{
            if( oDivConteneurTextePep = document.getElementById('bloc_telecharger_fiche_pep') ){
  						oDivConteneurTextePep.className = oDivConteneurTextePep.className.replace('visible','cachee');
  					}
          }
				}else{
          if( oDivConteneurTextePep = document.getElementById('bloc_telecharger_fiche_pep') ){
						oDivConteneurTextePep.className = oDivConteneurTextePep.className.replace('visible','cachee');
					}
        }
        // END ABO Suppression Etape Finition - 25/03/2010
				
				// on n'affiche la div document que si on a eu les informations a mettre dedans
				if( oDivConteneurBlocDocuments = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_documents') ){
					if(''+aReponse[4]+'' != '' && typeof(aReponse[4]) != 'undefined' && ''+aReponse[13]+'' != '' && typeof(aReponse[13]) != 'undefined' && ''+aReponse[14]+'' != '' && typeof(aReponse[14]) != 'undefined' && ''+aReponse[15]+'' != '' && typeof(aReponse[15]) != 'undefined' && ''+aReponse[16]+'' != '' && typeof(aReponse[16]) != 'undefined'){
						oDivConteneurBlocDocuments.className = oDivConteneurBlocDocuments.className.replace('cachee','visible');
					}else{
						oDivConteneurBlocDocuments.className = oDivConteneurBlocDocuments.className.replace('visible','cachee');
					}
				}

				// accessoires
				if(''+aReponse[17]+'' != '' && typeof(aReponse[17]) != 'undefined'){
					if( oDivConteneurAccessoires = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_conteneur_accessoire')){
						oDivConteneurAccessoires.innerHTML = aReponse[17];
					}
				}
				
				// pieces de rechange
				if(''+aReponse[18]+'' != '' && typeof(aReponse[18]) != 'undefined'){
					if( oDivConteneurPiecesRechange = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_conteneur_rechange')){
						oDivConteneurPiecesRechange.innerHTML = aReponse[18];
						oDivConteneurAstuces.className = oDivConteneurAstuces.className.replace('cachee','visible');
					}
				}

				// si accessoires et pieces de rechanges ont ete envoyes, afficher le conteneur. Sinon, le cacher
				if(oDivConteneurPiecesRechangesAccessoires = document.getElementById('tx-cimsarproducts-pi1_fiche_produit_accessoires_pieces')){
					if(''+aReponse[17]+'' != '' && typeof(aReponse[17]) != 'undefined' && ''+aReponse[18]+'' != '' && typeof(aReponse[18]) != 'undefined'){
						oDivConteneurPiecesRechangesAccessoires.className = oDivConteneurPiecesRechangesAccessoires.className.replace('cachee','visible');
					}else{
						oDivConteneurPiecesRechangesAccessoires.className = oDivConteneurPiecesRechangesAccessoires.className.replace('visible','cachee');
					}
				}

				if(oObjetAChanger){
					if(document.getElementsByClassName){
						oListeCouleursADeselectionner = document.getElementsByClassName('tx-cimsarproducts-pi1_fiche_produit_'+sClassName+'_liste_item_selected');
						for(iCptEnfants=0; iCptEnfants < oListeCouleursADeselectionner.length ; iCptEnfants++){
							oListeCouleursADeselectionner[iCptEnfants].className = oListeCouleursADeselectionner[iCptEnfants].className.replace('_selected','');
						}
						oObjetAChanger.className = oObjetAChanger.className + '_selected';
					}else{
						try{
							oListeDivs = oObjetAChanger.parentElement.parentElement.getElementsByTagName('div');
							for(iCptDiv = 0;iCptDiv < oListeDivs.length;iCptDiv ++){
								if(oListeDivs[iCptDiv].className == 'tx-cimsarproducts-pi1_fiche_produit_'+sClassName+'_liste_item_selected'){
									oListeDivs[iCptDiv].className = oListeDivs[iCptDiv].className.replace('_selected','');
								}
							}
						}catch(e){}
						oObjetAChanger.className = oObjetAChanger.className + '_selected';
					}
					
				}
				
				for (iCptBlocs = 0;iCptBlocs < aListeBlocs.length;iCptBlocs ++){
					if(aListeBlocs[iCptBlocs] != ''){
						if(aListeBlocs[iCptBlocs] == '') continue;
						if(oBlocCourant = document.getElementById(aListeBlocs[iCptBlocs])){
							if(iCptBlocs <= iEntree){
								oBlocCourant.style.display = 'block';
							}else{
								oBlocCourant.style.display = 'none';
							}
						}
					}
				}
			
			}
		}
	}	
	
	xhr.open("POST","/cimsarproducts_ajax.html",true); 
	xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xhr.send('tx_cimsarproducts_pi1[' + sCritereName + ']='+ sCritereValue.replace(/\+/g,'%2B') +'');
}

// JavaScript Document
function showHidePrice(oCallElement){
	if(
		(divPrix = document.getElementById('prix')) && 
		(lienMasquer = document.getElementById('masquer_prix_lien')) &&
		(lienAfficher = document.getElementById('afficher_prix_lien'))
	){
		if(oCallElement.id == "masquer_prix_lien"){
			divPrix.style.visibility = 'hidden';
			lienMasquer.style.display = 'none';
			lienAfficher.style.display = 'inline';
		}else{
			divPrix.style.visibility = 'visible';
			lienMasquer.style.display = 'inline';
			lienAfficher.style.display = 'none';
		}
	}
}

function bin2dec(sNumber){
	currnum = 128;
	sNumber = ""+sNumber+"";
	num2 = 0;
	for (i = 0; i <= 7; i++){
		num2 += (eval(sNumber.charAt(i)) * currnum);
		currnum /= 2;
	}
	return num2;
} 

