<!--

waJSQuery(window).load(function(){
initializeAllWA_market();
});
function initializeAllWA_market()
{
if(document.internalPreview!=true)
{
waJSQuery(".wa-market").each(function()
{
var Qnbrw=waJSQuery(this);
var nLQWM=extractParamInfo(Qnbrw,"id")
var pfgHF=extractParamInfo(Qnbrw,"id_modif") 
WA_declareMarket(Qnbrw,nLQWM,pfgHF)
Qnbrw.find(".wa-market-prod").each(function(i)
{
var sbNWY=waJSQuery(this)
sbNWY.css("cursor","pointer")
sbNWY.click(function()
{
WA_showMarketProduct(nLQWM,i)
return false
});
var SHdhw=sbNWY.find(".wa-market-prod-add")
SHdhw=SHdhw.find("img")
SHdhw.click(function()
{
WA_showMarketProduct(nLQWM,i,true)
return false;
});
});
});
waJSQuery(".wa-market-cart-quantity-field").each(function()
{
waJSQuery(this).data("origin_cart_html",waJSQuery(this).html())
})
WA_loadMarketStock()
}
waJSQuery(".wa-market-prod-add").each(function()
{
var FFPOm=waJSQuery(this) 
}) 
WA_refreshNumberMarketItemsInCart()
}
function MeFmf(FFPOm)
{
var BBkxp=FFPOm.html() 
var KmEJB=FFPOm.height()
for(var i=9;i<45;i++)
{
FFPOm.html("<div class='inner-content' style='position:absolute;'></div>")
var qmZdp=FFPOm.find(".inner-content")
qmZdp.empty()
qmZdp.html(BBkxp)
qmZdp.css({fontSize:i+"px"});
if(qmZdp.height()>=KmEJB)
{
FFPOm.html("<div class='inner-content' style='position:absolute;'></div>")
var qmZdp=FFPOm.find(".inner-content")
qmZdp.html(BBkxp)
qmZdp.css({fontSize:(i-1)+"px"});
break;
}
}
qmZdp.css({top:(FFPOm.height()-qmZdp.height())/2,left:(FFPOm.width()-qmZdp.width())/2})
}
function WA_declareMarket(TelYE,dcATt,GQHAV_modif)
{
var CbeIp=Translator.m_lang_for_filename
if(CbeIp.length>0)CbeIp="_"+CbeIp;
var CArrW=dcATt+'/market-definition'+CbeIp+'.js?v='+GQHAV_modif;
waJSQuery.getJSON(CArrW,function(PmATe)
{
if(typeof(wa_global_market.markets[dcATt])=="undefined")
{
WA_marketLoaded(PmATe,TelYE)
}
}).error(function(o,WMoxf){
})
}
function WA_marketLoaded(PmATe,bmEOv)
{
var GQHAV=PmATe.folder 
if(bmEOv!=null)
{
PmATe.obj_market=bmEOv
bmEOv.data("market",PmATe)
}
wa_global_market.markets[GQHAV]=PmATe;
var VWgIR=wa_global_market.markets[GQHAV]
var Qnbrw=new DrrbX(VWgIR)
VWgIR.obj=Qnbrw
var oxorc=document.wa_global_query_info
if(oxorc)
{
var otius=GQHAV;
if(otius==oxorc.m_unid)
{
WA_showMarketProduct(GQHAV,oxorc.m_index_item)
return;
}
}
}
function WA_loadMarketStock()
{
if(wa_global_market&&wa_global_market.UdeOK)
{
return;
}
var CArrW="wa_global_market_stock.js?t="+urlSuffixe(0);
waJSQuery.getJSON(CArrW,function(PmATe)
{
wa_global_market.UdeOK=true
var jVStV=new Array();
for(var i=0;i<PmATe.items.length;i++)
{
var rngHD=PmATe.items[i]
var GQHAV=rngHD.id
var JVXse=rngHD.q 
for(var n=0;n<JVXse.length;n++)
{
var IvpvI=JVXse[n]
var avrhC=GQHAV+"_"+n;
var MtFvU=new Array()
var QfbsN=IvpvI.split("|")
for(var n0=0;n0<QfbsN.length;n0++)
{
var lOsMw=QfbsN[n0]
var qFOrc=lOsMw.split("=")
if(qFOrc.length==2)
{
MtFvU[qFOrc[0]]=parseInt(qFOrc[1]) 
}
else
if(qFOrc.length==1)
{
MtFvU=parseInt(qFOrc[0])
}
}
jVStV[avrhC]=MtFvU
}
}
wa_global_market.tNwCn=jVStV
}) 
}
function MfQCt(sbNWY)
{
var n=0;
for(var i=0;i<sbNWY.options.length;i++)
{
var YREBF=sbNWY.options[i]
if(YREBF!=false)
{
n++;
}
}
return n
}
function WA_getMarketStock(GQHAV,faigv,AfpkT)
{
if(!(wa_global_market&&wa_global_market.UdeOK))
{
return "";
}
var fjijl=wa_global_market.markets[GQHAV]
var fdBTN=fjijl.products;
var sbNWY=fdBTN[faigv] 
if(sbNWY.stockable==false)
{
return ""
}
var ZluMR=GQHAV+"_"+faigv
var rngHD=wa_global_market.tNwCn[ZluMR]
var HjIgO=0;
{
for(var i=0;i<sbNWY.options.length;i++)
{
var YREBF=sbNWY.options[i]
if(YREBF!=false)
{
if(YREBF.opt_stockable)
{
HjIgO++;
}
}
}
}

if(HjIgO==0)
{
if(isNaN(rngHD)) return 0
return rngHD
}
var nOptsSelected=0;
for(var i=0;i<AfpkT.length;i++)
{
if(AfpkT[i]>-1)
{
var YREBF=sbNWY.options[i]
if(YREBF.opt_stockable)
{
nOptsSelected++;
}
}
}

if(nOptsSelected<HjIgO)
{
return ""
}
if(rngHD==undefined) return 0
var eQLwD=new Array()
for(var i=0;i<3;i++)
{
var YREBF=sbNWY.options[i]
if(YREBF.opt_stockable)
{
eQLwD[i]=AfpkT[i]
}
else
{
eQLwD[i]=-1
}
}
var avrhC=eQLwD[0]+"/"+eQLwD[1]+"/"+eQLwD[2] 
var IvpvI=rngHD[avrhC]
if(IvpvI==undefined)
{
return 0
}

return IvpvI
}
function WA_basicFormatPrice(v,eEcAe)
{
if(eEcAe==undefined)eEcAe=2
v=Math.round(v*100)/100 

var result="";
var dqdqM=".";
var s=v+"";
s=s.replace(/,/g,".")
var n=s.indexOf(".");
if(n>-1)
{
s=s+"00";
s=s.substring(0,n+3);
}
else
{
s+=dqdqM+"00"
}
s=s.replace(/\./g,CONST_WA_GLOBAL_SETTINGS.currency_decimal_symbol)
var result2=""
var pSPVK="";
var ind=s.lastIndexOf(CONST_WA_GLOBAL_SETTINGS.currency_decimal_symbol)
if(ind==-1)
{
ind=s.length()-1;
}
else
{
pSPVK=s.substring(ind)
ind--;
}
var nqLSj=0;
for(var i=ind;i>=0;i--)
{
result2=s.charAt(i)+result2
nqLSj++;
if(nqLSj==3)
{
result2=" "+result2
nqLSj=0
}
}
result=result2+pSPVK;
if(eEcAe==0)
{
if(Math.floor(v)==v)
{
result=result2
}
}
return result;
}
function WA_formatPrice(v)
{
var SVwQb=CONST_WA_GLOBAL_SETTINGS.currency_mnemonic 
var cUgPe=CONST_WA_GLOBAL_SETTINGS.currency_code
var eEcAe=2;
if((cUgPe=="F CFA")||(cUgPe=="XPF")) 
{
eEcAe=0;
}
var result=WA_basicFormatPrice(v,eEcAe);
if((CONST_WA_GLOBAL_SETTINGS.currency_code=="GBP")||(CONST_WA_GLOBAL_SETTINGS.currency_code=="USD")||(CONST_WA_GLOBAL_SETTINGS.currency_code=="AUD"))
{
result=SVwQb+result;
}
else
if(CONST_WA_GLOBAL_SETTINGS.currency_code=="BRL")
{
result=SVwQb+" "+result;
}
else
{
result=result+" "+SVwQb;
}
return result;
}
function DrrbX(eeMRx)
{
this.GQHAV=eeMRx.id;
this.id=eeMRx.id;
}
function WA_loadScriptDlgMarket(ZluMR,GQHAV,faigv,IDDYl)
{
if(document.wa_dlg_market_js_loaded==true)
{
UHLUu([ZluMR,GQHAV,faigv,IDDYl])
return;
}
WA_Dialog.progress();
WA_loadScript('wa_market/webacappella_dlg_market.js?v='+urlAntiCacheForPreview()+wa_global_market.id_modif_dlg_js,UHLUu,[ZluMR,GQHAV,faigv,IDDYl]);
}
function WA_showMarketCart()
{
WA_loadScriptDlgMarket("show_cart")
}
function WA_showMarketProduct(GQHAV,faigv,IDDYl)
{
WA_loadScriptDlgMarket("show_prod",GQHAV,faigv,IDDYl)
}
function UHLUu(kfrJV)
{
document.wa_dlg_market_js_loaded=true;
var ZluMR=kfrJV[0];
if(ZluMR=="show_cart") WA_displayDialogMarketCart()
if(ZluMR=="show_prod") WA_displayDialogMarketProduct(kfrJV[1],kfrJV[2],kfrJV[3])
}
function WA_getNumberMarketItemsInCart()
{
var TelYE=parseInt(WA_GetCookie("crbst-card-nb_items"))
if(isNaN(TelYE)) return 0;
return TelYE;
}
function WA_refreshNumberMarketItemsInCart()
{
var niUmb=WA_getNumberMarketItemsInCart();
waJSQuery(".wa-market-cart-quantity-field").each(function()
{
waJSQuery(this).html(waJSQuery(this).data("origin_cart_html").replace(/%/g,niUmb))
})
}
function printMarketForm()
{
var xpQZw=waJSQuery("#wa-dialog-content").html()
xpQZw=xpQZw.replace(/printMarketForm()/gi,"window.print()")
var osXFC=window.open("","my_print_area")
osXFC.document.writeln(xpQZw)
osXFC.document.close()
osXFC.print() 


}

-->
