

var fpServices=new Array();function fpService(A,B){this.cid=A;this.pid=B;this.qty=0;this.typ="s"}function fpAddService(A){fps=fpServices[A.value];if(fps==undefined){fps=new fpService(A.value.split("-")[0],A.value.split("-")[1]);if(A.value=="contrator"){fps.typ="co"}fpServices[A.value]=fps}fps.qty=A.checked?1:0;if(computePrice){fSetPrice=parseFloat(getPriceInHTML(document.getElementById("serprice_"+A.value).innerHTML));if(!A.checked){fSetPrice=0-fSetPrice}fProductPrice=parseFloat(getPriceInHTML(document.getElementById("productPrice").innerHTML));setPriceInHTML(document.getElementById("productPrice"),(fProductPrice+fSetPrice).toFixed(2))}}function getPriceInHTML(A){return(A.replace("&nbsp;","").match(/[^\d]*(\d+[,.]\d+)[^\d]*/)[1]).replace(",",".")}function setPriceInHTML(A,B){A.innerHTML=A.innerHTML.replace("&nbsp;","").replace(/([^\d]*)(\d+[,.]\d+)([^\d]*)/,"$1"+B.replace(".",",")+"$3").replace(/(\d+)(\d{3},\d{2})/,"$1&nbsp;$2")}function purchaseProductCo(){fpServices=new Array();fps=new fpService(-1,-1);fps.typ="co";fpServices.contrator=fps;fps.qty=1;purchaseProductServices(3)}function purchaseProductService(A,B){fpServices=new Array();fps=new fpService(A,B);fpServices[A+"-"+B]=fps;fps.qty=1;purchaseProductServices(4)}function purchaseBundle(G,C,F,B,D,E){URLPurchase="/info/basket/purchase_ba.cfm";var A="";for(i=0;i<F.split(",").length-1;i++){A+=",o"}for(ser in fpServices){if(fpServices[ser].typ=="s"&&fpServices[ser].qty>0){C+=","+fpServices[ser].cid;F+=","+fpServices[ser].pid;B+=","+fpServices[ser].qty;A+=","+fpServices[ser].typ}}URLPurchase+="?affPop=OK&baskdo=addproduct&FROMOPTIONCADDIE=yes&lstType="+A+"&Product_ID="+F+"&Product_CID="+C+"&qty="+B+"&BAId="+G+"&pp="+D+"&addedFrom="+E;if(fpServices.contrator!=undefined&&fpServices.contrator.qty>0){URLPurchase+="&okcontrator=oui"}Shop_AddProduct(URLPurchase)}function purchaseProduct(A){fpServices=new Array();purchaseProductServices(A);URLPurchase="/info/basket/purchase_ba.cfm"}function purchaseProductServices(A){URLPurchase="/info/basket/purchase_ba.cfm";purchaseBundle(BAId,cidsBase,pidsBase,qtysBase,pp,A)}; 
        
	

loc_Txt_erreur_mutlipleAssurance = "Vous ne pouvez ajouter plusieurs assurances pour un même produit";
loc_Txt_erreur_mutlipleExtentionGarantie = "Vous ne pouvez ajouter plusieurs extention de garanties pour un même produit";
loc_Txt_ChargementEnCours = "Chargement en cours...";
loc_Txt_ErreurDeChargment = "Erreur de chargement";
loc_Txt_ImpossibleAjouterService = "Impossible d\'ajouter ce service";
function OptServ(B,A,C){this.prd_cid=B;this.prd_pid=A;this.prd_bunid=C;this.prd_px=null;this.prd_pxhc=null;this.coeff=null;this.coeffmin=null;this.HaveCoeff=null}OptServ.prototype.set_prd_price=function(A){this.prd_price=A};OptServ.prototype.set_prd_price_horscoeff=function(A){this.prd_pxhc=A};OptServ.prototype.set_coeff=function(A){this.coeff=A};OptServ.prototype.set_coeffmin=function(A){this.coeffmin=A;this.HaveCoeff=(A==1)};OptServ.prototype.init=function(){$(".ctLstOpts").height($(".ctLstCat").height()+5);$(".pkObjOS").draggable({helper:"clone",opacity:"0.5",appendTo:$("#pkdragg")[0]});$(".pkTarget").droppable({accept:".pkObjOS",tolerance:"touch",drop:mypk.drop,activeClass:"pkTargetActive",hoverClass:"pkTargetHover"})};OptServ.prototype.ajoutOpt=function(B,J){if(typeof B=="string"){B=$(B)}if(typeof J=="string"){J=$(J)}$("#OneShotHelp")[0].style.display="none";var C=false,A=false,G=0,D=0,H=0,I=0,F=1;$("#pkTarget li.pkObjOS").each(function(){if(this.getAttribute("isservice")){C=C||this.getAttribute("isAssurance");A=A||this.getAttribute("isExtentionGarantie")}});if((B[0].getAttribute("isAssurance")&&C)||(B[0].getAttribute("isExtentionGarantie")&&A)){if(B[0].getAttribute("isAssurance")){$.prompt("<h3>"+loc_Txt_ImpossibleAjouterService+"</h3><p>"+loc_Txt_erreur_mutlipleAssurance+"</p>",{prefix:"brownJqi"})}if(B[0].getAttribute("isExtentionGarantie")){$.prompt("<h3>"+loc_Txt_ImpossibleAjouterService+"</h3><p>"+loc_Txt_erreur_mutlipleExtentionGarantie+"</p>",{prefix:"brownJqi"})}}else{if($("#pksel_"+B[0].id).length!=0){var E=$("#pksel_"+B[0].id+" input")[0];E.value=parseInt(E.value)+1}else{var E=B.clone();E[0].id="pksel_"+E[0].id;J.append(E)}}this.refreshPrice()};OptServ.prototype.drop=function(A,B){mypk.ajoutOpt(B.draggable,B.element)};OptServ.prototype.refreshPrice=function(){var A=0,F=0,D=0,C=0,E=1,G=null;$("#pkTarget li").each(function(){var I=parseInt(this.getElementsByTagName("input")[0].value),H=parseFloat(this.getAttribute("px"));if(this.getAttribute("isservice")){D+=H*I}else{if(this.getAttribute("isoption")){F+=H*I;C+=I}}});if(C>=5){E=0.9}else{if(C>=3){E=0.95}else{if(C==2){E=0.97}}}if(E!=1){$("#pkPrice").removeClass().addClass("priceEco");document.getElementById("pkPrice").style.marginTop="30px";var B=$("#packEcoValue").html("<strong>- "+(100-E*100)+"%</stong>")}else{$("#pkPrice").removeClass().addClass("price")}A=this.prd_pxhc*parseInt($("#qte_CID"+this.prd_cid+"PID"+this.prd_pid)[0].value);A+=F*E;if(this.HaveCoeff){if(A>this.coeffmin){A=A*this.coeff}}A+=D;A=Math.round(A*100)/100+" &euro;";A=A.replace(/\./gi,",");if((G=A.indexOf(","))>-1){if(A.charAt(G+2)==" "){A=A.replace(/ /gi,"0 ")}}$("#PackOptionServicePrice")[0].innerHTML=A};OptServ.prototype.plusMoins=function(C,B){var A=$("#qte_"+C)[0];A.value=parseInt(A.value)+B;if(A.value==0){if($("#qte_"+C).hasClass("TheProduct")){A.value=1}else{$("#pksel_"+C).remove();if($("#pkTarget li").length==0){$("#OneShotHelp")[0].style.display="block"}}}this.refreshPrice()};OptServ.prototype.getNewList=function(D,C,E,A){$(".lstOpts .pkObjOS").remove();$(".lstOpts .ttrLstOpts").html(A);$(".lstOpts .ctLstOpts").html("<div class='loading'>"+loc_Txt_ChargementEnCours+"<br><img src='/images/img-loading-mini.gif' width='20' heigth='20'/></div>");var B="/shared/ficheprod/getoptionsservicesproductbygroup.cfm?";B+="cid="+this.prd_cid;B+="&pid="+this.prd_pid;B+="&type="+D;B+="&optcid="+C;B+="&optcatid="+E;callHttpRequestRdc(B,"mypk.getNewList_retour","mypk.getNewList_erreur")};OptServ.prototype.getNewList_retour=function(A){$(".lstOpts .ctLstOpts").html(A.getElementsByTagName("datas")[0].childNodes[0].nodeValue);$(".pkObjOS").draggable({helper:"clone",opacity:"0.5",appendTo:$("#pkdragg")[0]})};OptServ.prototype.getNewList_erreur=function(){$(".lstOpts .ctLstOpts").html("<div class='erreur'>"+loc_Txt_ErreurDeChargment+"</div>")};OptServ.prototype.Acheter=function(){if(typeof (pageTracker)!="undefined"){var E="FicheProduitHT_pack_auto";if(typeof (gmht)!="undefined"){E="FicheProduitGMHT_pack_auto"}pageTracker._trackEvent("Boutons",E,"Ajouter_au_panier")}var A="/info/basket/purchase_ba.cfm",D=this.prd_cid,F=this.prd_pid,B="",C=$("#qte_CID"+this.prd_cid+"PID"+this.prd_pid)[0].value;A+="?affPop=OK";A+="&baskdo=addproduct";A+="&FROMOPTIONCADDIE=yes";A+="&BaId="+this.prd_bunid;A+="&pp="+this.prd_cid+"|"+this.prd_pid;$("#pkTarget li").each(function(){D+=","+this.getAttribute("cid");F+=","+this.getAttribute("pid");B+=(B==""?"":",")+(this.getAttribute("isoption")?"o":"")+(this.getAttribute("isservice")?"s":"");C+=","+this.getElementsByTagName("input")[0].value});A+="&Product_ID="+F;A+="&Product_CID="+D;A+="&qty="+C;A+="&lstType="+B;A+="&r="+Math.round(Math.random()*100000);Shop_AddProduct(A)}; 
        var lstSidHT = new Array('5');function highlightWord(B,C){return true;if(B.hasChildNodes){var A;for(A=0;A<B.childNodes.length;A++){highlightWord(B.childNodes[A],C)}}if(B.nodeType==3){tempNodeVal=B.nodeValue.toLowerCase();tempWordVal=C.toLowerCase();if(tempNodeVal.indexOf(tempWordVal)!=-1){pn=B.parentNode;if(pn.className!="searchword"){nv=B.nodeValue;ni=tempNodeVal.indexOf(tempWordVal);before=document.createTextNode(nv.substr(0,ni));docWordVal=nv.substr(ni,C.length);after=document.createTextNode(nv.substr(ni+C.length));hiwordtext=document.createTextNode(docWordVal);hiword=document.createElement("span");hiword.className="searchword";hiword.appendChild(hiwordtext);pn.insertBefore(before,B);pn.insertBefore(hiword,B);pn.insertBefore(after,B);pn.removeChild(B)}}}}function googleSearchHighlight(){if(!document.createElement){return }ref=document.referrer;if(ref.indexOf("?")==-1){return }qs=ref.substr(ref.indexOf("?")+1);qsa=qs.split("&");for(i=0;i<qsa.length;i++){qsip=qsa[i].split("=");if(qsip.length==1){continue}if(qsip[0]=="q"||qsip[0]=="p"||qsip[0]=="s"){words=unescape(qsip[1].replace(/\+/g," ")).split(/\s+/);for(w=0;w<words.length;w++){highlightWord(document.getElementById("fpContainerOuter").lastChild,words[w])}}}}function purchase(B,A){document.forms["purchase"+B+A].submit()}function poppurchase(){document.forms.purchase.submit()}function caddie(){opener.location.href="/info/basket/t_caddie.cfm";opener.focus();self.close()}function resizePopXL2(A){document.getElementById("txt_PopXl2").style.display="none";A.style.display="block";my_div2=document.getElementById("div_popupXL2");if(A.height+60>document.body.clientHeight){A.height_origine=A.height;A.height=document.body.clientHeight-100;document.getElementById("img_zoompopupXL2").style.display="block"}my_div2.style.width=(A.width+4)+"px";my_div2.style.height=(A.height+40+6)+"px";my_div2.style.top=(((document.documentElement.clientHeight-A.height-40)/2)+document.documentElement.scrollTop)+"px";my_div2.style.left=(((document.documentElement.clientWidth-A.width)/2)+document.documentElement.scrollLeft)+"px"}function popupXL2(E,D){if(typeof (vcis)!="undefined"){vcis("hidden")}var A,B;if(D==null){D="fr-fr"}if(!(A=document.getElementById("div_opaque"))){A=document.createElement("DIV");A.id="div_opaque";document.body.appendChild(A)}A.style.cssText="position:absolute;z-index:99;top:0px;left:0px;filter:alpha(opacity:60);display:;background:white";A.style.opacity=0.6;A.style.height=document.body.scrollHeight+"px";A.style.width=document.body.scrollWidth+"px";if(!(B=document.getElementById("div_popupXL2"))){B=document.createElement("DIV");B.id="div_popupXL2";document.body.appendChild(B)}B.style.padding="2px";B.style.background="white";B.style.zIndex=101;B.style.position="absolute";B.style.filter=null;B.style.opacity=1;B.style.width="550px";B.style.height="60px";B.style.top=(((document.body.clientHeight-130)/2)+document.body.scrollTop)+"px";B.style.left=(((document.body.clientWidth-550)/2)+document.body.scrollLeft)+"px";B.style.display="block";B.style.border="1px solid black";var C="<div style='width:100%;text-align:center' id='txt_PopXl2'><img src='http://www.rueducommerce.fr/image/img-loading-sm.gif' width='65' height='49'/></div>";C+="<img src='"+document.getElementById("xlCont").getElementsByTagName("img")[0].src+"' onload='resizePopXL2(this)' id='img_PopXL2' onclick=\"document.getElementById('div_popupXL2').style.display='none';document.getElementById('div_opaque').style.display='none';vcis('visible');\" style='display:none'>";imgbtacht="/images/bouton_acheter.gif";if(D!="fr-fr"){imgbtacht="/images/locales/"+D+"/bouton_acheter.gif"}if(document.getElementById("fp_imgachat_main")){C+="<img src='"+imgbtacht+"' onclick=\"document.getElementById('div_popupXL2').style.display='none';vcis('visible');document.getElementById('fp_imgachat_main').onclick()\" width='108' height='40' style='float:left;cursor:pointer' id='bt_acheter_zoom'>"}C+="<img src='/images/shops/"+D+"/ficheprod/bouton_fermer.gif' onclick=\"document.getElementById('div_popupXL2').style.display='none';document.getElementById('div_opaque').style.display='none';vcis('visible');\" width='108' height='40' style='float:right;cursor:pointer'>";C+="<img src='/images/xlocales/zoom_plus.gif' id='img_zoompopupXL2' onclick=\"popupXL2_zoom(this)\" width='95' height='51' style='position:absolute;top:5px;left:5px;cursor:pointer;display:none;filter:alpha(opacity:40);opacity:0.4' onmouseover=\"this.style.filter=null;this.style.opacity=1\" onmouseout=\"this.style.filter='alpha(opacity:40)';this.style.opacity=0.4\">";B.innerHTML=C}function popupXL2_zoom(A){obj=document.getElementById("img_PopXL2");my_div2=document.getElementById("div_popupXL2");if(obj.height==obj.height_origine){obj.height=document.body.clientHeight-100;A.src="/images/xlocales/zoom_plus.gif"}else{obj.height=obj.height_origine;A.src="/images/xlocales/zoom_moins.gif"}my_div2.style.width=(obj.width+4)+"px";my_div2.style.height=(obj.height+40+6)+"px";my_div2.style.left=(((document.body.clientWidth-obj.width)/2)+document.body.scrollLeft)+"px"}function showpopDesc(idpopdesc,e){var posx=0;var posy=0;if(!e){var e=window.event}if(e.pageX||e.pageY){posx=e.pageX;posy=e.pageY}else{if(e.clientX||e.clientY){posx=e.clientX+document.documentElement.scrollLeft;posy=e.clientY+document.documentElement.scrollTop}}with(document.getElementById(idpopdesc).style){display="block";left=posx+5+"px";top=parseInt(posy)+5+"px"}}function hidepopDesc(A){document.getElementById(A).style.display="none"}function getReduction(D,A,C){var B="/shared/prix/ajax/fp/getEconomie.cfm?c="+D+"&p="+A+(C!=null?"&pk="+C:"");callHttpRequestRdc(B,"getReductionBack")}function getReductionBack(C){if(C.getElementsByTagName("erreur").length==0){var B=getCookie("SID");var A="0";if(lstSidHT.find(B)>=0){A=C.getElementsByTagName("ecoht")[0].childNodes[0].nodeValue}else{A=C.getElementsByTagName("ecottc")[0].childNodes[0].nodeValue}if(A!="0"){if(C.getElementsByTagName("soldes").length==1){$("#fpReduc").addClass("fpReducPriceSoldes");$("#fpReduc .fpReducAvec").html("&nbsp;");$("#fpReduc .fpReducEco").html("&nbsp;");$("#fpReducPrice").html("-"+A+(A.indexOf("%")==-1?"€":""))}else{$("#fpReducPrice").html(A+(A.indexOf("%")==-1?"€":""))}$("#fpReduc").css("display","block");$("#fpReduc").css("visibility","visible")}}}function purchaseProduct(A){fpServices=new Array();purchaseProductServices(A);URLPurchase="/info/basket/purchase_ba.cfm"}function purchaseProductServices(A){URLPurchase="/info/basket/purchase_ba.cfm";purchaseBundle(BAId,cidsBase,pidsBase,qtysBase,pp,A)}function acheterProduct(A,B){if(typeof (pageTracker)!="undefined"){pageTracker._trackEvent("Boutons","FicheProduitHT","Ajouter_au_panier")}URLPurchase="/info/basket/purchase.cfm";URLPurchase+="?Product_ID="+A+"&Product_CID="+B;window.location.href=URLPurchase}function acheterProductSer(B,C){if(typeof (pageTracker)!="undefined"){pageTracker._trackEvent("Boutons","FicheProduitHT_et_services","Ajouter_au_panier")}URLPurchase="/info/basket/purchase_ba.cfm";var A="";for(i=0;i<pidsBase.split(",").length-1;i++){A+=",o"}for(ser in fpServices){if(fpServices[ser].typ=="s"&&fpServices[ser].qty>0){cidsBase+=","+fpServices[ser].cid;pidsBase+=","+fpServices[ser].pid;qtysBase+=","+fpServices[ser].qty;A+=","+fpServices[ser].typ}}URLPurchase+="?baskdo=addproduct&FROMOPTIONCADDIE=yes&lstType="+A+"&Product_ID="+pidsBase+"&Product_CID="+cidsBase+"&qty="+qtysBase+"&BAId="+BAId+"&pp="+pp+"&addedFrom=2";if(fpServices.contrator!=undefined&&fpServices.contrator.qty>0){URLPurchase+="&okcontrator=oui"}window.location.href=URLPurchase}function acheterBundle(A){if(typeof (pageTracker)!="undefined"){var B="FicheProduitHT_pack_front";if(typeof (gmht)!="undefined"){B="FicheProduitGMHT_pack_front"}pageTracker._trackEvent("Boutons",B,"Ajouter_au_panier")}window.location.href=A}; /***********************/
/* Fonctions générales */
/***********************/

function HideContent(d)
{
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}
function ShowContent(d,left,top) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	
  dd.style.left = left+"px";
  dd.style.top = top +"px";
  
	dd.style.display = "block";
}

function GMHTFormatPrix(valeur,decimal,separateur) {
  if (typeof decimal == 'undefined') decimal = 2;
  if (typeof separateur == 'undefined') separateur = " ";
  //formate un chiffre avec 'decimal' chiffres après la virgule et un separateur
	var deci=Math.floor( Math.pow(10,decimal)*(Math.abs(valeur)-Math.floor(Math.abs(valeur)))) ;
	var val=Math.floor(Math.abs(valeur));
	if ((decimal==0)||(deci==Math.pow(10,decimal))) {val=Math.floor(Math.abs(valeur)); deci=0;}
	var val_format=val+"";
	var nb=val_format.length;
	for (var i=1;i<4;i++) {
		if (val>=Math.pow(10,(3*i))) {
			val_format=val_format.substring(0,nb-(3*i))+separateur+val_format.substring(nb-(3*i));
		}
	}
	if (decimal>0) {
		var decim="";
		for (var j=0;j<(decimal-deci.toString().length);j++) {decim+="0";}
		deci=decim+deci.toString();
		val_format=val_format+","+deci;
	}
	if (parseFloat(valeur)<0) {val_format="-"+val_format;}
	return val_format;
}

function isGoodPrice ( px )
  {
    if ( typeof px == "undefined" ) return false;
    if (( typeof px == "string" ) && ( px == "" )) return false;
    if ( getPriceFloat( px ) != 0 ) return true;
  }

function getPriceFloat ( inn ) {

  if ((typeof inn == "undefined")||(inn == ""))
    return 0;
  else if (typeof inn == "number")
    return inn;
  else
    return parseFloat( inn.replace(/,/gi,".").replace(/ /gi,"") );
}

function chrono(jour,mois,annee,heure,minute,seconde) {
  var now = new Date()
  var goal = new Date(annee,mois-1,jour,heure,minute,seconde)
  var ts = (goal.getTime() - now.getTime())/1000
  if (ts > 0)
    {
    var j = Math.floor(ts/(3600*24))
    var h = Math.floor((ts-j*24*3600)/3600)
    var m = Math.floor((ts-j*24*3600-h*3600)/60)
    var s = Math.floor(ts-j*24*3600-h*3600-m*60)
    var html = ((j>1)?j+" jours ":(j>0)?j+" Jour ":"")
      + ((h<10)?" 0":" ")+h+"h "
      + ((m<10)?"0":"")+m+"mn "
      + ((s<10)?"0":"")+s+"s "
    $(".vfchronofp").html( "Plus que " + html + " !" );
    }
  else $(".vfchronofp").html( " C'est fini ! " );
}

function startChrono(jour,mois,annee,heure,minute,seconde) {
		chrono(jour,mois,annee,heure,minute,seconde)
    setTimeout("startChrono("+jour+","+mois+","+annee+","+heure+","+minute+","+seconde+")",1000);
}

/*****************/
/* CLASS : GMHT */
/****************/
oimage = function() {
	this.s = arguments[0];
	this.m = arguments[1];
	this.l = arguments[2];
}


gmht = function ( _p_cid , _p_mpid_master , _p_product_id , _p_partnumber , _p_fiche_rdc_active , _p_taux3fois , _p_seuil3fois , _p_coefpromo , _p_coefpromo_seuil , _p_5x_min , _p_5x_max , _p_5x_actif ) {
  /* les propriétés */
  _this = this;
  this.offers = new Array();
	this.images = new Array();
	this.currentImage = null;
	this.cid = null;
	this.mpid_master = null;
	this.product_id = null;
	this.partnumber = null;
	this.comparateur = null;
	this.comparateur_order = null;
	this.fiche_rdc_active = true;
	this.NomMarchand_RueDuCommerce = "Rue du Commerce";
	this.coefpromo_seuil = null;
	this.coefpromo = null;
	this._5x_min = null;
  	this._5x_max = null;
  	this._5x_actif = null;
  	this.seuilEconomie = 45;
	this.maxLinesLivraison = 8;
	
	/*partie constructeur*/
	this.cid = _p_cid;
	this.mpid_master = _p_mpid_master;
	this.product_id = _p_product_id;
	this.partnumber = _p_partnumber;
	this.fiche_rdc_active = _p_fiche_rdc_active;
	this.coefpromo_seuil = _p_coefpromo_seuil;
	this.coefpromo = _p_coefpromo;
	this._5x_min = _p_5x_min;
  this._5x_max = _p_5x_max;
  this._5x_actif = _p_5x_actif;
	/*fin partie constructeur*/
	
	this.defaultVisuelSmall = "http://www.rueducommerce.fr/images/no_result.small.jpg";
	this.defaultVisuelMedium = "http://www.rueducommerce.fr/images/no_result.large.jpg";
	this.defaultVisuelLarge = "http://www.rueducommerce.fr/images/no_result.large.jpg";

	this.load = function () {
	
	  var domaine = document.location.href;
    domaine = domaine.substr ( 7 , domaine.indexOf("/",7) - 7 ); // 7 c'est pour http://
    if (( domaine == "www.rueducommerce.fr" ) || ( domaine == "search.rueducommerce.fr" ))
      url = "http://www.rueducommerce.fr/m/high_tech/get_v3_response.php?url=1&mpid=" + this.mpid_master + "&fpgmht=1";
    else {
      //url = "/proxy.cfm?url=" + escape( "http://www.test.alapage.com/m/_scripts/product_offer_enhanced.php?mpid=" + this.mpid_master + "&fpgmht=1" );
      url = "/proxy.cfm?url=" + escape( "http://www.alapage.com/m/_scripts/product_offer_enhanced.php?mpid=" + this.mpid_master + "&fpgmht=1" );		
	}
	
    callHttpRequestRdc( url , this , this )
  	if ($('div.videoFP img').length > 0)
     {
  		$('div.videoFP').hide();
  		$('div.imgVideo').click($('div.videoFP img').attr('onclick')).show();
	   }
	}
	
	this.callback = function( xmlrequest ) {
    var offres = xmlrequest.getElementsByTagName("offre");

    for ( var i = 0 ; i < offres.length ; i++ )
      {
        /* lecture de l'offre dans un tableau temporaire */
        tmp_offre = new Array();
        tmp_offre["position"] = i;
        // infos marchand
        var marchand = offres[i].getElementsByTagName("marchand")[0];
        tmp_offre["marchand"] = new Array();
        tmp_offre["marchand"]["nom"] = marchand.getElementsByTagName("nom")[0].childNodes[0].nodeValue;
        tmp_offre["marchand"]["note"] = marchand.getElementsByTagName("note")[0].hasChildNodes() ? marchand.getElementsByTagName("note")[0].childNodes[0].nodeValue : "";
        tmp_offre["marchand"]["mention"] = marchand.getElementsByTagName("mention")[0].hasChildNodes() ? marchand.getElementsByTagName("mention")[0].childNodes[0].nodeValue : "";
        if ( tmp_offre["marchand"]["nom"] == this.NomMarchand_RueDuCommerce ) tmp_offre["marchand"]["note"] = 5;
        
        /* l'offre RDC a été désactivée entre temps. */
        if ( ( tmp_offre["marchand"]["nom"] == this.NomMarchand_RueDuCommerce ) && (this.fiche_rdc_active == false) )
          continue;
          
        // infos qu'on reprend telque prix / soldes / promo / flash
        var noeud_prix = offres[i].getElementsByTagName( "prix" )[0]
        tmp_offre["prix"] = new Array();
        lst = new Array( "normal" , "soldes" , "promo" , "flash" );
        for ( var k = 0 ; k < lst.length ; k++)
          {
            var noeud = lst[k];
            if ( noeud_prix.getElementsByTagName( noeud ).length > 0 )
              {
                tmp_offre["prix"][ noeud ] = new Array();
                var node = noeud_prix.getElementsByTagName( noeud )[0];
                for ( var j = 0 ; j < node.childNodes.length ; j++ )
                  {
                    if ( node.childNodes[j].nodeType == 1 )
                        tmp_offre["prix"][ noeud ][node.childNodes[j].nodeName] = node.childNodes[j].hasChildNodes() ? node.childNodes[j].childNodes[0].nodeValue : "";
                  }
              }
          }
        if ( noeud_prix.getElementsByTagName( "fraisdeport" ).length > 0)
          tmp_offre["prix"]["fraisdeport"] = noeud_prix.getElementsByTagName("fraisdeport")[0].childNodes[0].nodeValue

        if ( tmp_offre["marchand"]["nom"] == this.NomMarchand_RueDuCommerce )
          {
            var px = getPriceFloat ( tmp_offre["prix"]["normal"]["prix"] )
            
            /* calcule du 3 fois*/
            if ( px >= _p_seuil3fois )
              {
                tmp_offre["prix"]["prix3x"] = ( px * ( 1 + ( _p_taux3fois / 100 ) ) ) / 3 ;
                tmp_offre["prix"]["prix3x"] = GMHTFormatPrix( tmp_offre["prix"]["prix3x"] );
              }
            else { tmp_offre["prix"]["prix3x"] = ""; }
          }
        else { tmp_offre["prix"]["prix3x"] = ""; }

        /* infos livraison */
        tmp_offre["livraisons"] = new Array();
          /*livraison la moins chère*/
        tmp_offre["livraisons"]["mini"] = new Array();
        var livraisons = offres[i].getElementsByTagName("livraisons")[0].getElementsByTagName("livraisonmini")[0];
        elts = new Array( "delai" , "date" , "moyen" , "prix" )
        for ( var elt = 0 ; elt < elts.length ; elt++ )
          {
            var tmp = livraisons.getElementsByTagName(elts[elt])
            tmp_offre["livraisons"]["mini"][ elts[elt] ] = tmp.length == 1 && tmp[0].childNodes.length == 1 ? tmp[0].childNodes[0].nodeValue : "";
          }
          
          
          /* autre mode de livraison */
        tmp_offre["livraisons"]["autre"] = new Array();
        livraisons = offres[i].getElementsByTagName("livraisons")[0].getElementsByTagName("livraisonautre");
        elts = new Array( "delai" , "moyen" , "prix" )
        for ( var j = 0 ; j < livraisons.length ; j++ )
          {
            tmp_offre["livraisons"]["autre"][j] = new Array();
            for ( var elt = 0 ; elt < elts.length ; elt++ )
              {
                var tmp = livraisons[j].getElementsByTagName(elts[elt])
                tmp_offre["livraisons"]["autre"][j][ elts[elt] ] = tmp.length == 1 ? tmp[0].childNodes[0].nodeValue : "";
              }
          }

        /* les visuels */
        if ( this.images.length == 0 )
        {
			var visuels = offres[i].getElementsByTagName("visuels");
			if(visuels.length > 0 && visuels[0].childNodes.length > 0){
				var bigVisuel = "";
				for ( var j = 0 ; j < visuels.length ; j++ )
				{
					try {bigVisuel = visuels[j].getElementsByTagName("big")[0].childNodes[0].nodeValue}
					catch(e){
						try {bigVisuel = visuels[j].getElementsByTagName("maxi")[0].childNodes[0].nodeValue}
						catch(e){bigVisuel = ""}
					}
					
					this.addImage(
						visuels[j].getElementsByTagName("mini")[0].childNodes[0].nodeValue,
						visuels[j].getElementsByTagName("medium")[0].childNodes[0].nodeValue,
						bigVisuel
					);
				}
			}
        }
        
        /* le stock */
        var st = offres[i].getElementsByTagName("stock")[0];
        tmp_offre["stock"] = new Array();
        tmp_offre["stock"]["code"] = st.getElementsByTagName("code")[0].childNodes[0].nodeValue;
        tmp_offre["stock"]["libelle"] = st.getElementsByTagName("libelle")[0].childNodes[0].nodeValue;
        
        /* autres infos */
        tmp_offre["url_achat"] = offres[i].getElementsByTagName("url_achat")[0].childNodes[0].nodeValue;
        tmp_offre["cgv"] = offres[i].getElementsByTagName("url_cgv")[0].hasChildNodes() ? offres[i].getElementsByTagName("url_cgv")[0].childNodes[0].nodeValue : "";

        /*fin lecture de l'offre*/
        this.offers.push( tmp_offre );
      }
    this.displayImages();
    if (offres.length > 0)  {
    	/* maskage de certain block si rdc n'est pas le représentant */
    	if (this.offers[0]["marchand"]["nom"] != this.NomMarchand_RueDuCommerce ){
    		$(".tab_AccessoiresetServices, .tab_PkOptServ, .tab_BundleAuto, .tab_NosPacks , .reducssite, .uneuros, .prodcomp, .srvrdc").hide();
		} else {
			$(".srvgm").hide();
		}
		
    	/* chargement fini... on peux afficher le contenu */
    	this.displayBlocPrice();
    	this.displayBlocLivraison();
  		//this.displayBlocService();
  		this.displayBlocMarchand();
  		/*
  		if ( this.offers[0]["marchand"]["mention"] != "" )
        {
          $(".mention").html(this.offers[0]["marchand"]["mention"]).show();
        }
        */
  		$(".fp .content .waiter").hide();
  		$(".fp .content .center").show();
		  $(".fp .content .right").show();
    } else {
    	// Pas d'offres, on masque
    	$(".fp .content .waiter").hide();
    	$(".fp .blcPrice, .fp .trsp, .fp .services, .fp .uneuros").hide();
    	$(".tab_AccessoiresetServices, .tab_PkOptServ, .tab_BundleAuto, .tab_NosPacks").hide();
    	$(".fp .center, .fp .inactive").show();
    	$(".fp .content .right").show();
    	$(".fp .marchands, .fp .reducs").hide();
    }
  }
  
  this.callbackError = function() {
    // Pas d'offres, on masque
    $(".fp .content .waiter").hide();
    $(".fp .blcPrice, .fp .trsp, .fp .services, .fp .uneuros").hide();
    $(".tab_AccessoiresetServices, .tab_PkOptServ, .tab_BundleAuto, .tab_NosPacks").hide();
    $(".fp .center, .fp .inactive").show();
    $(".fp .content .right").show();
    $(".fp .marchands, .fp .reducs").hide();
  }

	this.addImage = function (_s, _m, _l) {
		this.images.push(new oimage(_s, _m, _l));
	}

	this.stopwait = function () {
		$(".fp .content .waiter").hide();
		$(".fp .content .center").show();
		$(".fp .content .right").show();
	}


	this.purchase = function ( num ) {
		if (typeof(pageTracker) != 'undefined') {	
			var oDivComparateur = document.getElementById('popcomparateur');
			var sTrackEvent = 'FicheProduitGMHT';
			if(oDivComparateur.style.display == 'block')
				sTrackEvent = 'FicheProduitGMHT_comparateur_offres';
			pageTracker._trackEvent('Boutons', sTrackEvent, 'Ajouter_au_panier'); //tracking xiti pour le button acheter
		}	  
		document.location.href = "http://www.rueducommerce.fr" + this.offers[num]["url_achat"];

	}

  this.getCgv = function ( num ) {
    window.open ( this.offers[num]["cgv"] , '' , '' );
  }

  /*************************/
  /* fonctions d'affichage */
  /*************************/
  
  /* libelle pour l'économie (entré : tableau à 2 dim avec au moins en elt economie et economiepc */
  this.getLibEconomie = function ( px )
  {
    var tmp_px = getPriceFloat( px["economie"] );
    var tmp_pc = getPriceFloat( px["economiepc"] );
    if ( tmp_px < this.seuilEconomie )
      return GMHTFormatPrix( tmp_pc , 0 )  + "&nbsp;%"
    else
      return GMHTFormatPrix( tmp_px , 0 ) + "&nbsp;&euro;"
  }
  
  /* Affichage des visuels */
	this.displayImages = function () {
	
		var defaultVisuel = false;
		if(this.images.length == 0){
			this.addImage(
				this.defaultVisuelSmall,
				this.defaultVisuelMedium,
				this.defaultVisuelLarge
			);
			defaultVisuel = true;
		}
		
		$('#mainimg img').attr('l',this.images[0].l).attr('m',this.images[0].m).attr('src',this.images[0].m);
		$('#thumbs>img').remove();	
		
		if(!defaultVisuel){
			for (i = 0; i< this.images.length && i < 4; i++) {
				img = this.images[i];
				$('#thumbs').append( 
						$('<img />')
							.attr("src",img.s).attr("m",img.m).attr("l",img.l)
							.mouseover (function(){
								$('#mainimg img').attr('src',$(this).attr('m')).attr('l',$(this).attr('l'));
							}));
			}
		}
	}

  /* Affichage du bloc prix */
  this.displayBlocPrice = function ( _p_offer_num ) {
  
    if ( typeof _p_offer_num == "undefined" ) _p_offer_num = 0;
    var offre = this.offers[_p_offer_num];
    
    var cgv = "<br><span onclick='gmht.getCgv(0)' class='cgv'>(Voir CGV)</span>";
    
    $(".prices span.marchand").html( offre["marchand"]["nom"] );
    var prix_finale = getPriceFloat( offre["prix"]["normal"]["prix"] );
    

    /*retail*/
    if ( isGoodPrice (offre["prix"]["normal"]["retail"]) )
      $("#retail em").html( offre["prix"]["normal"]["retail"] + "&nbsp;&euro;" );
    else
      $("#retail").hide();

    /* gestion solde / flash */
    if ( typeof offre["prix"]["soldes"] != "undefined" )
      {
        /* affichage du bandeau solde*/
        var sd = $("<div class='soldefp'>")
        $(".blcPrice").before( sd );
        
        /*affichage des prix */
        $(".pricevf,.pricepromo").hide();
        
        if ( offre["prix"]["soldes"]["retail"] == offre["prix"]["normal"]["retail"] ) $("#retail").hide();
        
        $(".pricemarchand").addClass("prixBarre");
        $(".pricemarchand .px_ctc").html(offre["prix"]["soldes"]["retail"]+"&nbsp;&euro;")
        $(".pricemarchand .px_lib").html ( $(".pricemarchand .px_lib").html().replace(/:/gi , ' avant les soldes :' )  )

        var i = 1;
        while ( typeof offre["prix"]["soldes"]["demarque" + i] != "undefined" )
          {
            $("<tr>").html("<td class='px_lib'>"+ i + " " + (i==1?"ère":"ème") + " démarque :</td><td class='px_ctc' nowrap>" + offre["prix"]["soldes"]["demarque" + i] + "</td>")
            i++;
          }

        $(".pricesoldes .pxsld .px_ctc").html( offre["prix"]["soldes"]["prix"] + "&nbsp;&euro;")

        if ( isGoodPrice(offre["prix"]["soldes"]["ecotaxe"]) )
          $(".ecoPart span").html( offre["prix"]["soldes"]["ecotaxe"] + "&nbsp;&euro;" );
        else $(".ecoPart").hide();
        
        prix_finale = getPriceFloat( offre["prix"]["soldes"]["prix"] );

      }
    else if ( typeof offre["prix"]["flash"] != "undefined" )
      {
        /* affichage du bandeau vente flash*/
        var vf = $("<div class='vfchronofp'>")
        $(".blcPrice").before( vf );
        //exemple de date : 2009-11-29 00:00:00
        var dte = offre["prix"]["flash"]["datefin"].replace(/[-:]/gi," ");
        dte = dte.split(" ");
        startChrono( dte[2] , dte[1] , dte[0] , dte[3] , dte[4] , dte[5] );
        
        /* affichage des prix */
        $(".pricesoldes,.pricepromo").hide();
        $(".pricemarchand").addClass("prixBarre");
        $(".pricemarchand .px_ctc").html(offre["prix"]["flash"]["retail"]+"&nbsp;&euro;");
        $(".pricevf .px_ctc").html(offre["prix"]["flash"]["prix"] + "&nbsp;&euro;");
        $(".pricevf .px_lib").html( $(".pricevf .px_lib").html() + cgv );
        if ( isGoodPrice(offre["prix"]["flash"]["ecotaxe"]) )
          $(".ecoPart span").html( offre["prix"]["flash"]["ecotaxe"] + "&nbsp;&euro;" );
        else $(".ecoPart").hide();
        prix_finale = getPriceFloat( offre["prix"]["flash"]["prix"] );
      }
    else if ( ( typeof offre["prix"]["promo"] != "undefined" ) && ( offre["marchand"]["nom"] != this.NomMarchand_RueDuCommerce) ) /* les promos non RDC */
      {
        $(".pricesoldes,.pricevf").hide();
        $(".pricemarchand").addClass("prixBarre");
        $(".pricemarchand .px_ctc").html(offre["prix"]["promo"]["retail"]+"&nbsp;&euro;")
        $(".pricepromo .px_ctc").html(offre["prix"]["promo"]["prix"] + "&nbsp;&euro;");
        $(".pricepromo .px_lib").html($(".pricepromo .px_lib").html() + cgv );
        if ( isGoodPrice(offre["prix"]["promo"]["ecotaxe"]) )
          $(".ecoPart span").html( offre["prix"]["promo"]["ecotaxe"] + "&nbsp;&euro;" );
        else $(".ecoPart").hide();
        prix_finale = getPriceFloat( offre["prix"]["promo"]["prix"] );
      }
    else
      {
        $(".pricesoldes,.pricevf,.pricepromo").hide();
        if ( isGoodPrice(offre["prix"]["normal"]["prix"]) )
          {
            $(".pricemarchand .px_ctc").html(offre["prix"]["normal"]["prix"]+"&nbsp;&euro;")
            $(".pricemarchand .px_lib").html( $(".pricemarchand .px_lib").html() + cgv )
          }
          
        if ( isGoodPrice(offre["prix"]["normal"]["ecotaxe"]) )
          $(".ecoPart span").html( offre["prix"]["normal"]["ecotaxe"] + "&nbsp;&euro;" )
        else
          $(".ecoPart").hide();
      }

    /* les promo RDC*/
    if ( offre["marchand"]["nom"] == this.NomMarchand_RueDuCommerce)
      {
        if (( this.coefpromo < 1 ) && ( prix_finale > this.coefpromo_seuil ))
          {
            $(".pricemarchand").addClass("prixBarre");
            $(".pricepromo .px_ctc").html( GMHTFormatPrix(prix_finale * this.coefpromo) + "&nbsp;&euro;");
            offre["prix"]["normal"]["prix"] = GMHTFormatPrix(prix_finale * this.coefpromo);
            $(".prices .px_lib .cgv,.prices .px_lib br").remove();
            $(".pricepromo .px_lib").html ( $(".pricepromo .px_lib").html().replace(/promo/gi , '"-' + (100-this.coefpromo*100) + '%"' ) + cgv  );
            $(".pricepromo").show();
            
            if ( isGoodPrice(offre["prix"]["normal"]["economie"]) )
            {
              // y'avait déjà une économie
              var px = getPriceFloat( offre["prix"]["normal"]["economie"] );
              var pc = getPriceFloat( offre["prix"]["normal"]["economiepc"] );
              var newpx = px + ( prix_finale - prix_finale * this.coefpromo );
              var newpc = Math.floor( px * newpx / px );
              offre["prix"]["normal"]["economie"] = GMHTFormatPrix ( newpx );
              offre["prix"]["normal"]["economiepc"] = newpc;
            }
            else
            {
              // y'avait pas d'économie avant
              var px = getPriceFloat( offre["prix"]["normal"]["prix"] );
              offre["prix"]["normal"]["economie"] = GMHTFormatPrix ( px - px  * this.coefpromo );
              offre["prix"]["normal"]["economiepc"] = 100 - 100 * this.coefpromo;
            }
          }
        else $(".pricepromo").hide();
      }

    /*affichage de l'économie => on prends toutes les économies valide et on prends la plus grande valeur */
    var lstEconomie = new Array();
    if ( isGoodPrice(offre["prix"]["normal"]["economiepc"]) )
      lstEconomie.push( {"economiepc":getPriceFloat(offre["prix"]["normal"]["economiepc"]),"economie":getPriceFloat(offre["prix"]["normal"]["economie"])} );
    if (( typeof offre["prix"]["soldes"] != "undefined") && ( isGoodPrice(offre["prix"]["soldes"]["economiepc"])))
      lstEconomie.push( {"economiepc":getPriceFloat(offre["prix"]["soldes"]["economiepc"]),"economie":getPriceFloat(offre["prix"]["soldes"]["economie"])} );
    if (( typeof offre["prix"]["flash"] != "undefined") && ( isGoodPrice(offre["prix"]["flash"]["economiepc"]))) 
      lstEconomie.push( {"economiepc":getPriceFloat(offre["prix"]["flash"]["economiepc"]),"economie":getPriceFloat(offre["prix"]["flash"]["economie"])} );
    if (( typeof offre["prix"]["promo"] != "undefined") && ( isGoodPrice(offre["prix"]["promo"]["economiepc"]))) 
      lstEconomie.push( {"economiepc":getPriceFloat(offre["prix"]["promo"]["economiepc"]),"economie":getPriceFloat(offre["prix"]["promo"]["economie"])} );
    if (lstEconomie.length > 0)
    {
      lstEconomie.sort( function(a,b) {return a["economie"] - b["economie"]} ).reverse();
      $(".econom .px_ctc em").html( this.getLibEconomie ( lstEconomie[0] ) );
    }
    else
      $(".econom").hide();

    /* on barre tous les prix à barrer */
    $(".prices .prixBarre .px_ctc").each( function () { $(this).html( "<em>" + $(this).html() + "</em>" ) } );

    /*le 3 fois*/
    if ( isGoodPrice( offre["prix"]["prix3x"] ) ) $("#troisfois .ctc").html( offre["prix"]["prix3x"] + "&nbsp;&euro;" );
    else $("#troisfois").hide();
    
    /*le 5 fois*/
    if (( prix_finale >= this._5x_min ) && ( prix_finale <= this._5x_max ) && ( this._5x_actif == 1 ) && (isGoodPrice(offre["prix"]["normal"]["prix5x"])) )
      $("#cinqfois .ctc").html( offre["prix"]["normal"]["prix5x"] + "&nbsp;&euro;");
    else $("#cinqfois").hide();

    /*la dispo*/
    $("#dispo").html( this.getDispo(0) );

    
  }
  
  this.getDispo = function ( _p_pos ) {
    if ( this.offers[_p_pos]["marchand"]["nom"] == this.NomMarchand_RueDuCommerce)
      return "<img src='http://www.rueducommerce.fr/shared/delais/delai.afm?cid="+this.cid+"&pid="+this.product_id+"&s=10&pn="+this.partnumber+"&loc=FProd&r=0'>";
    else
      return "<div class='text_dispo_" + this.offers[_p_pos]["stock"]["code"] + "'>" + this.offers[_p_pos]["stock"]["libelle"] + "</div>";
  }
  
  /* Affichage du bloc livraison */
  this.displayBlocLivraison = function ( _p_nummarchand ) {
    if ( typeof _p_nummarchand == "undefined" ) _p_nummarchand = 0;
    if ( this.offers[_p_nummarchand]["marchand"]["nom"] == this.NomMarchand_RueDuCommerce )
      this.displayBlocLivraison_RDC(_p_nummarchand);
    else
      this.displayBlocLivraison_default(_p_nummarchand);
    
    if ( $(".fp .trsp ul:first li").length == 0 ) $(".fp .trsp").hide();
    else
 	{
	  	this._undisplayBlocLivraison();
	  	this._fixedBlocLivraison();
    }
  }
  
  /* fixation de la hauteur*/
  this._fixedBlocLivraison = function( ) {
  	var nb = $(".fp .trsp ul:first li:visible").length;
  	var hauteur = nb * 15;
    hauteur = hauteur + $(".fp .trsp ul:first li.withpuce:visible").length * 5;
    $(".fp .trsp").height( hauteur > 60 ? hauteur : 60 );
  }
  
  /* modifie la liste si elle fait plus de maxLinesLivraison lignes
   * ajout d'un bouton + d'infos pour afficher toutes les lignes
   * ajout d'un bouton - d'infos pour masquer les lignes
   */ 
  this._undisplayBlocLivraison = function( ) {
  	
  	var eltsLi = $(".fp .trsp ul:first li").get();
  	var eltsLiToDisplay = new Array();
	
  	if ( eltsLi.length > this.maxLinesLivraison ) {
  		$(".fp .trsp ul:first li").remove();
  		for ( var cpt=0; cpt < eltsLi.length; cpt++ ) {
  			if ( cpt >= this.maxLinesLivraison ){
  				$(eltsLi[cpt]).css("display","none");
  			}
  			if ( cpt == this.maxLinesLivraison ) {
  				var eltLiShow = $("<li id='btShowLivraison'>").html("<span class='linkShow'>+ d'infos</span>");
				$(".fp .trsp ul:first").append(eltLiShow);
				var context = this;
				$('#btShowLivraison').click( 
					function() {
						$('#btShowLivraison ~ li').show("");
						$('#btShowLivraison').css("display","none");
						$('#btHideLivraison').css("display","block");
						context._fixedBlocLivraison();
					}
				);
  			}
			$(".fp .trsp ul:first").append(eltsLi[cpt]);
			if ( ( cpt +1 ) == eltsLi.length ) {
  				var eltLiHide = $("<li id='btHideLivraison'>").html("<span class='linkShow'>- d'infos</span>");
  				$(eltLiHide).css("display","none");
				$(".fp .trsp ul:first").append(eltLiHide);
  				var context = this;
				$('#btHideLivraison').click( 
					function() {
						$('#btShowLivraison ~ li').hide("");
						$('#btShowLivraison').css("display","block");
						$('#btHideLivraison').css("display","none");
						context._fixedBlocLivraison();
					}
				);
  			} 
  		}
  	}
  }
  
  this.displayBlocLivraison_RDC = function ( _p_nummarchand ) {
    if ( typeof _p_nummarchand == "undefined" ) _p_nummarchand = 0;
    var dataliv = this.offers[_p_nummarchand]["livraisons"];
    
    /*cas transporteur spéciale*/
    if ( dataliv["mini"]["moyen"] == "Transporteur spécial" )
      {
        var li = $("<li>").html( "Frais de port : " +  dataliv["mini"]["prix"] );
      	$(".fp .trsp ul").append( li );
      	return true;
      }

    /*autres cas*/
    var lst_transport = new Array();
    var rg = new RegExp("[^a-zA-Z0-1]","g");

    lst_transport[ dataliv["mini"]["moyen"].replace(rg,"_") ] = dataliv["mini"];
    
    for ( i = 0 ; i < dataliv["autre"].length ; i++ )
      {
        lst_transport[ dataliv["autre"][i]["moyen"].replace(rg,"_") ] = dataliv["autre"][i];
      }

    var donotdisplay_colissimo = false;
    
    if ( typeof lst_transport["Chronopost"] != "undefined" )
      {
        var px = getPriceFloat ( lst_transport["Chronopost"]["prix"] );
        donotdisplay_colissimo = ( px < 10 );
      
        var txt = "Livraison en <strong>24h</strong> par Chronopost ";
        if ( px == 0 ) txt += "<strong>gratuite</strong>";
        else txt += "pour <strong>" + lst_transport["Chronopost"]["prix"] + "&nbsp;&euro;</strong>";
        txt += ". <span onclick=\"window.open('/Aide/29-Modes-de-livraison/#02')\">(+ d'infos)</span>";
        var li = $("<li class='withpuce'>").html( txt );
        $(".fp .trsp ul").append( li );
      }

    if ( (! donotdisplay_colissimo) && ( typeof lst_transport["Livraison_Normale"] != "undefined" ) )
      {
        var txt = "Livraison par Colissimo ";
        var px = getPriceFloat ( lst_transport["Livraison_Normale"]["prix"] );
        if ( px == 0 ) txt += "<strong>gratuite</strong>";
        else txt += "pour <strong>" + lst_transport["Livraison_Normale"]["prix"] + "&nbsp;&euro;</strong>";
        txt += ". <span onclick=\"window.open('/Aide/29-Modes-de-livraison/#01')\">(+ d'infos)</span>";
        var li = $("<li class='withpuce'>").html( txt );
        $(".fp .trsp ul").append( li );
        if ( typeof lst_transport["Livraison_Normale"]["date"] != "undefined" )
        {
          var reg_date  = new RegExp("([0-9]{2,2}/[0-9]{2,2}/[0-9]{4,4})", "gi");
          li = $("<li>").html( lst_transport["Livraison_Normale"]["date"].replace( reg_date , "<strong>$1</strong>" ) ) ;
          $(".fp .trsp ul").append( li );
        }
        else
        {
          li = $("<li>").html( "Prévue en <strong>2 à 3 jours ouvrés</strong>" );
          $(".fp .trsp ul").append( li );
        }
      }

    if ( typeof lst_transport["Relai"] != "undefined" )
      {
        var px = getPriceFloat ( lst_transport["Relai"]["prix"] );

        var txt = "Livraison en point relais ";
        if ( px == 0 ) txt += "<strong>offerte</strong>";
        else txt += "pour <strong>" + lst_transport["Relai"]["prix"] + "&nbsp;&euro;</strong>";
        txt += ". <span onclick=\"window.open('/Aide/29-Modes-de-livraison/#03')\">(+ d'infos)</span>";
        var li = $("<li class='withpuce'>").html( txt );
        $(".fp .trsp ul").append( li );
        li = $("<li>").html( "Prévue en <strong>3 à 5 jours ouvrés</strong>" );
        $(".fp .trsp ul").append( li );
      }
    
  }

	this.displayBlocLivraison_default = function ( _p_nummarchand ) {

    if ( typeof _p_nummarchand == "undefined" ) _p_nummarchand = 0;
    var dataliv = this.offers[_p_nummarchand]["livraisons"];
    var lst_trsp = new Array ( dataliv["mini"] );
    lst_trsp = lst_trsp.concat( dataliv["autre"] );
    for ( var i = 0 ; i < lst_trsp.length ; i++ )
      {

        var lib = trim(lst_trsp[i]["moyen"]);
        var px = getPriceFloat ( lst_trsp[i]["prix"] );
        if ( px == 0 ) lib += " offert";
        else lib += " " + lst_trsp[i]["prix"] + "&nbsp;&euro;";

        var max_length = 55;
        var add_puce = true
        while ( lib != "" )
          {
            var lib_aff = "";
            if ( lib.length > max_length )
              {

                var pos = lib.indexOf( " " , max_length );
                if (pos == -1 )
                  {
                    lib_aff = lib;
                    lib = "";
                  }
                else
                  {
                    lib_aff = lib.substr(0,pos);
                    lib = trim(lib.substr(pos));
                  }
              }
            else
              {
                lib_aff = lib;
                lib = "";
              }
            var li = $("<li "+ (add_puce?"class='withpuce'":"") +">").html( lib_aff );
            $(".fp .trsp ul").append( li );
            add_puce = false;
          }

        if ( typeof lst_trsp[i]["date"] != "undefined" )
          {
            var reg_date  = new RegExp("([0-9]{2,2}/[0-9]{2,2}/[0-9]{4,4})", "gi");
            li = $("<li>").html( lst_trsp[i]["date"].replace( reg_date , "<strong>$1</strong>" ) );
          }
        else
          {
            var delais = lst_trsp[i]["delai"]; 
            if (delais > 48) delais = Math.ceil(delais / 24) + " jours ouvrés."
            else delais += "h ouvrées."
            li = $("<li >").html( "Livraison prévue en <strong>" + delais + "</strong>");
          }
        $(".fp .trsp ul").append( li );
      }

    
  }

	/* Affichage du bloc autre marchand */
	this.displayBlocMarchand = function () {

    if ( this.offers.length > 1 )
      {
        for ( var i = 1 ; i < this.offers.length && i < 5 ; i++ )
          {

				    var html = "<h3>"+this.offers[i]["marchand"]["nom"]+"</h3><div class='prixMarchand'>"+this.offers[i]["prix"]["normal"]["prix"]+"&nbsp;&euro;</div>";
            html += "<br class='clear'/>";
            if ( this.offers[i]["marchand"]["note"] != "")
              {
    				    html += "<div class='stars'>";
    					  if (this.offers[i]["marchand"]["note"]>0) html += "<div style='width:" + (20*Math.floor(this.offers[i]["marchand"]["note"])) + "%'></div>";
    				    html += "</div>";
				      }
            else
              {
                html += "<div style='float:left'>";
                html += "Pas de note";
                html += "</div>";
              }
				    html += "<br class='clear'/>";

            var div = $("<div class='ligneMarchand'>").html(html);
            $(".fp .marchands .linkOffre").before(div);
          }
        $(".fp .marchands .linkOffre span#nb").html(this.offers.length);
      }
    else { $(".fp .marchands").hide(); }
	}

	this.getMinPrice = function ( ) {
  
  	var min = getPriceFloat( this.offers[0]["prix"]["prix"] );

    for ( var i = 1 ; i < this.offers.length ; i ++ )
      {
        tmp = getPriceFloat ( this.offers[i]["prix"]["prix"] );
        if ( min > tmp ) min = tmp;
      }

    return GMHTFormatPrix( min );
  }
  
	this.getMinPriceFP = function ( ) {

  	var min = getPriceFloat ( this.offers[0]["prix"]["normal"]["prix"] ) + getPriceFloat( this.offers[0]["prix"]["fraisdeport"] );

    for ( var i = 1 ; i < this.offers.length ; i ++ )
      {
        tmp = getPriceFloat ( this.offers[i]["prix"]["normal"]["prix"] ) + getPriceFloat ( this.offers[i]["prix"]["fraisdeport"] ) ;
        if ( min > tmp ) min = tmp;
      }

    return GMHTFormatPrix ( min );
  }
	
	/********************/
	/* le configurateur */
	/********************/
	this.comparateur_show = function () {
	
    /* affichage du div transparent*/
    if ( ! ( my_div = document.getElementById("div_opaque") ) )
			{
				my_div = document.createElement("DIV")
				my_div.id = "div_opaque"
				document.body.appendChild( my_div )
			}
		my_div.style.cssText="position:absolute;z-index:99;top:0px;left:0px;filter:alpha(opacity:60);display:;background:white"
		my_div.style.opacity = .6
		my_div.style.height = document.body.scrollHeight + "px"
		my_div.style.width =  document.body.scrollWidth + "px"
    /* affichage du div comparateur */
    my_div2 = document.getElementById("popcomparateur")
		my_div2.style.filter = null;
		my_div2.style.opacity = 1;
		my_div2.style.width = "920px";
		//my_div2.style.height = "60px"
		my_div2.style.top = (10+document.documentElement.clientHeight) + "px"
		my_div2.style.left = ( ( (document.documentElement.clientWidth-920) /2) + document.documentElement.scrollLeft) + "px"
		

		if (this.comparateur == null) this.comparateur = this.offers.slice();
		this.comparateur_displayListe();

		$("#popcomparateur .blocproduit span.px").html( this.getMinPriceFP()+ "&nbsp;&euro;"  );
		
		my_div2.style.display = "block";
    hauteurMax = document.documentElement.clientHeight - 20;
    if ( document.getElementById("popcomparateur").offsetHeight > hauteurMax)
      {
        $("#popcomparateur .ctc").css("height",(hauteurMax-200)+"px")
        $("#popcomparateur .ctc").css("overflow","auto");
        my_div2.style.width = "860px";
        my_div2.style.left = ( ( (document.documentElement.clientWidth-860) /2) + document.documentElement.scrollLeft) + "px"
      }

    my_div2.style.top = (((document.documentElement.clientHeight-document.getElementById("popcomparateur").offsetHeight)/2)+document.documentElement.scrollTop) + "px"
  }

  this.comparateur_displayListe =  function ( _p_order ) {
    if ( typeof _p_order == "undefined" ) _p_order = null;
    this.comparateur_orderBy(_p_order);
    
    $("#ListeOffre tr.data").remove();
    for ( var i = 0 ; i < this.comparateur.length ; i++ )
      {
        var tr = $("<tr class='data "+((this.comparateur[i]["marchand"]["mention"]!="")&&(1==2)?'noborder':'')+" ligne"+(i%2)+"'>");
        var tds = "<td class='col1'>" + this.comparateur[i]["marchand"]["nom"] + "<br>";

        if ( this.comparateur[i]["marchand"]["note"] != "")
              {
    				    tds += "<div class='stars'>";
    					  if (this.comparateur[i]["marchand"]["note"]>0) tds += "<div style='width:" + (20*Math.floor(this.comparateur[i]["marchand"]["note"])) + "%'></div>";
    				    tds += "</div>";
				      }
            else
              {
                tds += "Pas de note";
              }
        tds += "</td>";
         
        tds += "<td class='col2'>"+this.getDispo(this.comparateur[i]["position"])+"</td>";
        tds += "<td class='col3'>"+this.comparateur[i]["livraisons"]["mini"]["date"]+"</td>";
        tds += "<td class='col4'>" + this.comparateur[i]["prix"]["normal"]["prix"] + "&nbsp;&euro;</td>";

        if (this.comparateur[i]["livraisons"]["mini"]["prix"] == "0.00" )
          tds += "<td class='col6'>gratuit</td>";
        else
          tds += "<td class='col6'>"+this.comparateur[i]["livraisons"]["mini"]["prix"]+"&nbsp;&euro;</td>";
        
        var total = getPriceFloat( this.comparateur[i]["prix"]["normal"]["prix"] );
        total += getPriceFloat(this.comparateur[i]["prix"]["fraisdeport"] );
        tds += "<td class='col7'>"+GMHTFormatPrix(total)+"&nbsp;&euro;</td>";
        tds += "<td class='col8'><div class='btht pngFix' onclick='gmht.purchase("+this.comparateur[i]["position"]+");return false;'></div>";
        tr.html(tds);
        $("#ListeOffre").append( tr );
        // mention marchand pas encore actif, (pour plus tard)
        /*
        if ( this.comparateur[i]["marchand"]["mention"] != "" )
          {
            var tr2 = $("<tr class='data'>");
            var tds2 = "<td class='mentioncompligne"+(i%2)+" pngFix' colspan='7'>" + this.comparateur[i]["marchand"]["mention"] + "</td>";
            tr2.append(tds2);
            $("#ListeOffre").append( tr2 );
          }
        */
      }
    if (typeof DD_belatedPNG != "undefined" ) DD_belatedPNG.fix('.pngFix');
  }
  
  this.comparateur_close = function () {
    $("#div_opaque , #popcomparateur").hide();
  }
	this.comparateur_orderBy = function ( _p_order ) {
 	   this.comparateur = this.offers.slice();
 	   this.comparateur.sort( eval("sort_" + ( _p_order != null ? _p_order : 'prixtot_asc' ) ) );
 	   if ( _p_order != null )
      {
       $("#ListeOffre th img").each( function() { this.src = this.src.replace(/On.gif/gi,".gif") } );
       $("#ListeOffre th img." + _p_order).each( function() { this.src = this.src.replace(/.gif/gi,"On.gif") } );
      }
  }
	this.purchaseComp = function (_cid, _pid) {
		if (typeof(pageTracker) != 'undefined') {	
			pageTracker._trackEvent('Boutons', 'FicheProduitGMHT_upsell', 'Ajouter_au_panier'); //tracking xiti pour le button acheter
		}		
		Shop_AddProduct('/info/basket/purchase.cfm?affPop=OK&baskdo=addproduct&FROMOPTIONCADDIE=yes&Product_CID='+_cid+'&Product_ID='+_pid);
	}
}

function sort_date_liv_desc ( a , b ) { return sort_date_liv_asc ( b , a ); }
function sort_date_liv_asc ( a , b ) { return parseInt(a["livraisons"]["mini"]["delai"]) - parseInt(b["livraisons"]["mini"]["delai"]); }
function sort_prix_desc ( a , b ) { return sort_prix_asc ( b , a ); }
function sort_prix_asc ( a , b ) { return getPriceFloat(a["prix"]["normal"]["prix"]) - getPriceFloat(b["prix"]["normal"]["prix"]); }
function sort_fraisport_desc ( a , b ) { return sort_fraisport_asc ( b , a ); }
function sort_fraisport_asc ( a , b ) { return getPriceFloat(a["prix"]["fraisdeport"]) - getPriceFloat(b["prix"]["fraisdeport"]); }
function sort_prixtot_desc ( a , b ) { return sort_prixtot_asc ( b , a ); }
function sort_prixtot_asc ( a , b ) {
  var av = getPriceFloat(a["prix"]["normal"]["prix"]) + getPriceFloat(a["prix"]["fraisdeport"]);
  var bv = getPriceFloat(b["prix"]["normal"]["prix"]) + getPriceFloat(b["prix"]["fraisdeport"]);
  return av - bv;
}

