<!--

function eREZP(GFKWn)
{
var FZEHr=GFKWn[0]
var xWpsN=wa_global_market.markets[FZEHr]
var PXSgb=new jWgoS(xWpsN)
xWpsN.obj=PXSgb
PXSgb.roEGw()
var YxujS=document.wa_global_query_info
if(YxujS)
{
if(FZEHr==YxujS.m_unid)
{
WA_showMarketProduct(FZEHr,YxujS.m_index_item)
return;
}
}
}
function WA_loadMarket()
{
for(var RwtDp in wa_global_market.markets)
{
var PXSgb=wa_global_market.markets[RwtDp]
if(PXSgb)
{
var PBaKd=Translator.m_lang_for_filename
if(PBaKd.length>0)PBaKd="_"+PBaKd;
WA_loadScript(PXSgb.src_folder+'/market-definition'+PBaKd+'.js?v='+PXSgb.id_modif,eREZP,[RwtDp]);
}
}
WA_refreshNumberMarketItemsInCart()
}
function WA_formatPrice(v)
{
var result="";
if(Math.ceil(v)==v)result=""+v;
else
{
var s=v+"";
var n=s.indexOf(".");
if(n==-1)n=s.indexOf(",");
if(n>-1)
{
s=s+"00";
s=s.substring(0,n+3);
}
result=s;
}
var vwkla=''
try{vwkla=CONST_WA_GLOBAL_SETTINGS.currency_mnemonic}catch(e){}
if(CONST_WA_GLOBAL_SETTINGS.currency_code=="GBP")
{
result=vwkla+result;
}
else
{
result=result+" "+vwkla;
}
return result;
}
function bMgNU(c,ax,ay,bx,by,dashLength){
var dx=ax-bx;
var dy=ay-by;
var angle=Math.atan2(dy,dx)/(Math.PI/180)+90;
if(angle>180) angle-=360;
c.moveTo(ax,ay);
for(var i=0;i*dashLength<Math.sqrt(dx*dx+dy*dy);i++){
var cx=ax-(i*dashLength)*Math.sin(angle*(Math.PI/180));
var cy=ay+(i*dashLength)*Math.cos(angle*(Math.PI/180));
if(i%2==0){c.lineTo(cx,cy);
}else{
c.moveTo(cx,cy);
}
}
}
function brxKV(PXSgb,Fewbl,FnJVn,FZEHr)
{
this.rKhdK=function()
{
var ElVgm=""
var kKQqJ=false;
var srTdP="WA_showMarketProduct('"+PXSgb.FZEHr+"',"+FnJVn+")"
kKQqJ=new WA_GraphicElement(this.FZEHr+"-sep",60,false)
kKQqJ.uXQFJ=this.uXQFJ
kKQqJ.draw=function()
{
var uXQFJ=this.uXQFJ
var nafMZ=uXQFJ.prod_global_separator_pt1
var EXWLa=uXQFJ.prod_global_separator_pt2
var cbhYv=document.getElementById(this.canvasId())
var IZaCQ=cbhYv.getContext('2d');
IZaCQ.strokeStyle=uXQFJ.prod_global_separator_col
bMgNU(IZaCQ,nafMZ.x+0.5,nafMZ.y+0.5,EXWLa.x+0.5,EXWLa.y+0.5,2)
IZaCQ.stroke()
}
kKQqJ.setOnClick(srTdP);
var OOdKF=this.uXQFJ.r_prod_inner.clone()
OOdKF.translate(this.JVIKD.x,this.JVIKD.y)
kKQqJ.setRect(OOdKF.x,OOdKF.y,OOdKF.width+1,OOdKF.height+1)
ElVgm+=kKQqJ.toHtml()
this.oUxYR.push(kKQqJ) 

kKQqJ=new WA_GraphicElement(this.FZEHr+"-zone0",10,false)
kKQqJ.uXQFJ=this.uXQFJ
kKQqJ.draw=function()
{
var uXQFJ=this.uXQFJ
WA_bg(this.canvasId(),this.rect().width,this.rect().height,uXQFJ.prod_global_corner,1,uXQFJ.prod_global_border_col,[uXQFJ.prod_global_gradient],this.shadow()) 
}
var OOdKF=this.uXQFJ.r_prod_inner.clone()
OOdKF.translate(this.JVIKD.x,this.JVIKD.y)
kKQqJ.setRect(OOdKF.x,OOdKF.y,OOdKF.width+1,OOdKF.height+1)
ElVgm+=kKQqJ.toHtml()
this.oUxYR.push(kKQqJ) 

kKQqJ=new WA_GraphicElement(this.FZEHr+"-zone1",25,false)
kKQqJ.uXQFJ=this.uXQFJ
kKQqJ.draw=function()
{
var uXQFJ=this.uXQFJ
WA_bg(this.canvasId(),this.rect().width,this.rect().height,uXQFJ.prod_desc_corner,1,uXQFJ.prod_desc_border_col,[uXQFJ.prod_desc_gradient],this.shadow())
}
OOdKF=this.uXQFJ.lay_rect_desc.clone()
OOdKF.translate(this.JVIKD.x,this.JVIKD.y)
kKQqJ.setRect(OOdKF.x,OOdKF.y,OOdKF.width+1,OOdKF.height+1)
ElVgm+=kKQqJ.toHtml()
this.oUxYR.push(kKQqJ) 
OOdKF=this.uXQFJ.lay_rect_desc_inner.clone()
OOdKF.translate(this.JVIKD.x,this.JVIKD.y)
ElVgm+="<div style=\"position:absolute;z-index:50;";
ElVgm+="left:"+OOdKF.x+"px;top:"+OOdKF.y+"px;";
ElVgm+="cursor:pointer;";
ElVgm+="width:"+OOdKF.width+"px;"
ElVgm+="height:"+OOdKF.height+"px;";
ElVgm+="font-family:"+this.uXQFJ.prod_desc_font_family+";"
ElVgm+="font-size:"+this.uXQFJ.prod_desc_font_size+"px;"
ElVgm+="color:"+this.uXQFJ.prod_desc_col+";"
ElVgm+="margin:3px;"
ElVgm+="padding:0px;"
ElVgm+="\" ";
ElVgm+=">";
ElVgm+="<div style=\"";
ElVgm+="font-weight:bold;"
ElVgm+="\">";
ElVgm+=this.Fewbl.title
ElVgm+="</div>";
ElVgm+="<div style=\"";
ElVgm+="\">";
ElVgm+=this.Fewbl.sub_title
ElVgm+="</div>";
ElVgm+="</div>";

kKQqJ=new WA_GraphicElement(this.FZEHr+"-zone2",25,false)
kKQqJ.uXQFJ=this.uXQFJ
kKQqJ.draw=function()
{
var uXQFJ=this.uXQFJ
WA_bg(this.canvasId(),this.rect().width,this.rect().height,uXQFJ.prod_price_corner,1,uXQFJ.prod_price_border_col,[uXQFJ.prod_price_gradient],this.shadow())
}
OOdKF=this.uXQFJ.lay_rect_price.clone()
OOdKF.translate(this.JVIKD.x,this.JVIKD.y)
kKQqJ.setRect(OOdKF.x,OOdKF.y,OOdKF.width+1,OOdKF.height+1)
ElVgm+=kKQqJ.toHtml()
this.oUxYR.push(kKQqJ)
ElVgm+="<div style=\"position:absolute;z-index:50;";
ElVgm+="left:"+OOdKF.x+"px;top:"+OOdKF.y+"px;";
ElVgm+="width:"+OOdKF.width+"px;";
ElVgm+="height:"+OOdKF.height+"px;";
ElVgm+="line-height:"+OOdKF.height+"px;";
ElVgm+="font-family:"+this.uXQFJ.prod_desc_font_family+";"
ElVgm+="font-size:"+this.uXQFJ.prod_price_font_size+"px;"
ElVgm+="color:"+this.uXQFJ.prod_price_col+";"
ElVgm+="text-align:center;"
ElVgm+="\">";
if(this.Fewbl.unavail)
{
ElVgm+="/" 
}
else
{
ElVgm+=WA_formatPrice(this.Fewbl.price)
}
ElVgm+="</div>";

kKQqJ=new WA_GraphicElement(this.FZEHr+"-zone3",25,this.uXQFJ.img_has_shadow)
kKQqJ.uXQFJ=this.uXQFJ
kKQqJ.Fewbl=this.Fewbl
kKQqJ.draw=function()
{
var uXQFJ=this.uXQFJ
var Fewbl=this.Fewbl
if(Fewbl.img_thumb.length>0)
{
if(this.shadow())
{
WA_bg(this.canvasId(),this.dwKlO_thumb.width,this.dwKlO_thumb.height,0,0,'',["#000000"],this.shadow(),0,1.0,false)
}
}
else
{
WA_bg(this.canvasId(),this.rect().width,this.rect().height,0,0,'',["rgba(60,60,60,0.2)"],false)
}
}
OOdKF=this.uXQFJ.lay_rect_img.clone()
OOdKF.translate(this.JVIKD.x,this.JVIKD.y)
if(this.Fewbl.img_thumb.length>0)
{
var tYRLQ_thumb=new Size(OOdKF.width+1,OOdKF.height+1)
kKQqJ.dwKlO_thumb=this.Fewbl.size_thumb.clone()
if(this.uXQFJ.crop_thumb)
{
kKQqJ.dwKlO_thumb=tYRLQ_thumb
}
else
{
kKQqJ.dwKlO_thumb.scale(tYRLQ_thumb,true)
}
var SESoL=Math.round((OOdKF.width-kKQqJ.dwKlO_thumb.width)/2);
var fWIAG=Math.round((OOdKF.height-kKQqJ.dwKlO_thumb.height)/2);
OOdKF.translate(SESoL,fWIAG)
kKQqJ.setRect(OOdKF.x,OOdKF.y,kKQqJ.dwKlO_thumb.width,kKQqJ.dwKlO_thumb.height)
}
else
{
kKQqJ.setRect(OOdKF.x,OOdKF.y,OOdKF.width+1,OOdKF.height+1)
}
if(this.Fewbl.img_thumb.length>0)
{
ElVgm+="<div style=\"position:absolute;z-index:100;";
ElVgm+="left:"+OOdKF.x+"px;top:"+OOdKF.y+"px;\" >";
ElVgm+="<a href=\"javascript:"+srTdP+"\" >";
ElVgm+="<img border=0 src='"+this.Fewbl.img_thumb+"' width='"+kKQqJ.dwKlO_thumb.width+"px' height='"+kKQqJ.dwKlO_thumb.height+"px'>"
ElVgm+="</a>"
ElVgm+="</div>"
}
ElVgm+=kKQqJ.toHtml()
this.oUxYR.push(kKQqJ)
return ElVgm;
}
this.DRDXg=function()
{
for(var i=0;i<this.oUxYR.length;i++)
{
var kKQqJ=this.oUxYR[i]
kKQqJ.registerDynamicCanvas()
}
}
this.FZEHr=FZEHr;
this.id=FZEHr;
this.index=FnJVn
this.Fewbl=Fewbl;
this.market=PXSgb;
this.uXQFJ=PXSgb.uXQFJ
this.oUxYR=new Array()
}
function jWgoS(anMBh)
{
this.roEGw=function()
{
var YFRvd="market-main-"+this.FZEHr
var weGtP=html_getLayer(YFRvd)
var EhvPY=this.qEvVY.products
var unTDY=0;
var iriki=0;
var ElVgm=""
var loABO=0;
var rNATP=0;
var OrXUO=this.uXQFJ.r_prod 
for(var i=0;i<EhvPY.length;i++)
{
var Fewbl=EhvPY[i]
var BciwE=new brxKV(this,Fewbl,i,this.FZEHr+"prod"+i)
Fewbl.obj=BciwE
BciwE.JVIKD=new Point(unTDY,iriki)
ElVgm+=BciwE.rKhdK()
rNATP++;
if(rNATP==this.uXQFJ.cols)
{
rNATP=0;
loABO++;
iriki+=OrXUO.height
unTDY=0;
}
else
{
unTDY+=OrXUO.width
}
}
weGtP.innerHTML=ElVgm
WA_exec_callback_opera_compliant(this,this.MDoRg)
}
this.MDoRg=function()
{
var EhvPY=this.qEvVY.products
for(var i=0;i<EhvPY.length;i++)
{
var Fewbl=EhvPY[i]
Fewbl.obj.DRDXg()
}
}
this.struct=anMBh;
this.anMBh=anMBh;
this.FZEHr=anMBh.id;
this.id=anMBh.id;
this.qEvVY=anMBh.info
this.info=anMBh.info
this.uXQFJ=anMBh.info.design
}
function WA_loadScriptDlgMarket(xOhet,FZEHr,qaVaF)
{
if(document.wa_dlg_market_js_loaded==true)
{
TVuka([xOhet,FZEHr,qaVaF])
return;
}
WA_Dialog.progress();
WA_loadScript('wa_dlg_emarket.js?v='+wa_global_market.id_modif_dlg_js,TVuka,[xOhet,FZEHr,qaVaF]);
}
function WA_showMarketCart()
{
WA_loadScriptDlgMarket("show_cart") 
}
function WA_showMarketProduct(FZEHr,qaVaF)
{
WA_loadScriptDlgMarket("show_prod",FZEHr,qaVaF) 
}
function TVuka(GFKWn)
{
document.wa_dlg_market_js_loaded=true;
var xOhet=GFKWn[0];
if(xOhet=="show_cart") WA_displayDialogMarketCart()
if(xOhet=="show_prod") WA_displayDialogMarketProduct(GFKWn[1],GFKWn[2])
}
function WA_getNumberMarketItemsInCart()
{
var MHAJQ=parseInt(WA_GetCookie("crbst-card-nb_items"))
if(isNaN(MHAJQ)) return 0;
return MHAJQ;
}
function GmTtR(xOhet,LGsEh)
{
var weGtP=html_getLayer(xOhet)
if(weGtP)
{
if(!LGsEh)LGsEh=Translator.tr("My card\u0020(%) article(s)");
var aEdUS=LGsEh
aEdUS=aEdUS.replace(/%/g,WA_getNumberMarketItemsInCart())
weGtP.innerHTML=aEdUS
}
}
function WA_refreshNumberMarketItemsInCart()
{
for(var xOhet in document.wa_global_button_market_declaration)
{
var LGsEh=document.wa_global_button_market_declaration[xOhet]
if(xOhet.indexOf("market-cart-link")==0)
{
GmTtR(xOhet,LGsEh)
}
else
{
var PLeCj=html_getLayer(xOhet+"-div0"+"-text")
if(!PLeCj)PLeCj=xOhet+"-div0"
var suUZY=html_getLayer(xOhet+"-div1"+"-text")
if(!suUZY)suUZY=xOhet+"-div1"
GmTtR(PLeCj,LGsEh)
GmTtR(suUZY,LGsEh)
}
}
}

-->
