<!--

function RKBeh(HiFhK)
{
var OiSqc=HiFhK[0]
var qGouk=wa_global_market.markets[OiSqc]
var fisYk=new NbleJ(qGouk)
qGouk.obj=fisYk
fisYk.aggxQ()
var WOeKe=document.wa_global_query_info
if(WOeKe)
{
if(OiSqc==WOeKe.m_unid)
{
WA_showMarketProduct(OiSqc,WOeKe.m_index_item)
return;
}
}
}
function WA_loadMarket()
{
for(var wTtqJ in wa_global_market.markets)
{
var fisYk=wa_global_market.markets[wTtqJ]
if(fisYk)
{
var mphRe=Translator.m_lang_for_filename
if(mphRe.length>0)mphRe="_"+mphRe;
WA_loadScript(fisYk.src_folder+'/market-definition'+mphRe+'.js?v='+fisYk.id_modif,RKBeh,[wTtqJ]);
}
}
WA_refreshNumberMarketItemsInCart()
}
function WA_basicFormatPrice(v)
{
v=Math.round(v*100)/100
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;
}
return result;
}
function WA_formatPrice(v)
{
var KMqBa=CONST_WA_GLOBAL_SETTINGS.currency_mnemonic
var result=WA_basicFormatPrice(v);
if(CONST_WA_GLOBAL_SETTINGS.currency_code=="GBP")
{
result=KMqBa+result;
}
else
if(CONST_WA_GLOBAL_SETTINGS.currency_code=="BRL")
{
result=KMqBa+" "+result;
}
else
{
result=result+" "+KMqBa;
}
return result;
}
function kSVWp(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 jBSRa(fisYk,PgfBL,GBfTN,OiSqc)
{
this.dmcal=function()
{
var YMmAF=""
var GTfdO=false;
var kpPJk="WA_showMarketProduct('"+fisYk.OiSqc+"',"+GBfTN+")"
GTfdO=new WA_GraphicElement(this.OiSqc+"-sep",60,false)
GTfdO.jJNEo=this.jJNEo
GTfdO.draw=function()
{
var jJNEo=this.jJNEo
var UAQAR=jJNEo.prod_global_separator_pt1
var ZXBip=jJNEo.prod_global_separator_pt2
var NhPgh=document.getElementById(this.canvasId())
var dpZwV=NhPgh.getContext('2d');
dpZwV.strokeStyle=jJNEo.prod_global_separator_col
kSVWp(dpZwV,UAQAR.x-0.5,UAQAR.y+0.5,ZXBip.x-0.5,ZXBip.y+0.5,2)
dpZwV.stroke()
}
GTfdO.setOnClick(kpPJk);
var HSOXO=this.jJNEo.r_prod_inner.clone()
HSOXO.translate(this.kkSSH.x,this.kkSSH.y)
GTfdO.setRect(HSOXO.x,HSOXO.y,HSOXO.width+1,HSOXO.height+1)
YMmAF+=GTfdO.toHtml()
this.rwFPJ.push(GTfdO) 

GTfdO=new WA_GraphicElement(this.OiSqc+"-zone0",10,false)
GTfdO.jJNEo=this.jJNEo
GTfdO.draw=function()
{
var jJNEo=this.jJNEo
WA_bg(this.canvasId(),this.rect().width,this.rect().height,jJNEo.prod_global_corner,1,jJNEo.prod_global_border_col,[jJNEo.prod_global_gradient],this.shadow()) 
}
var HSOXO=this.jJNEo.r_prod_inner.clone()
HSOXO.translate(this.kkSSH.x,this.kkSSH.y)
GTfdO.setRect(HSOXO.x,HSOXO.y,HSOXO.width+1,HSOXO.height+1)
YMmAF+=GTfdO.toHtml()
this.rwFPJ.push(GTfdO) 

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

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

GTfdO=new WA_GraphicElement(this.OiSqc+"-zone3",25,this.jJNEo.img_has_shadow)
GTfdO.jJNEo=this.jJNEo
GTfdO.PgfBL=this.PgfBL
GTfdO.draw=function()
{
var jJNEo=this.jJNEo
var PgfBL=this.PgfBL
if(PgfBL.img_thumb.length>0)
{
if(this.shadow())
{
WA_bg(this.canvasId(),this.vSUSq.width,this.vSUSq.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)
}
}
HSOXO=this.jJNEo.lay_rect_img.clone()
HSOXO.translate(this.kkSSH.x,this.kkSSH.y)
if(this.PgfBL.img_thumb.length>0)
{
var onvQB_thumb=new Size(HSOXO.width+1,HSOXO.height+1)
GTfdO.vSUSq=this.PgfBL.size_thumb.clone()
if(this.jJNEo.crop_thumb)
{
GTfdO.vSUSq=onvQB_thumb
}
else
{
GTfdO.vSUSq.scale(onvQB_thumb,true)
}
var wNcQj=Math.round((HSOXO.width-GTfdO.vSUSq.width)/2);
var WhYxW=Math.round((HSOXO.height-GTfdO.vSUSq.height)/2);
HSOXO.translate(wNcQj,WhYxW)
GTfdO.setRect(HSOXO.x,HSOXO.y,GTfdO.vSUSq.width,GTfdO.vSUSq.height)
}
else
{
GTfdO.setRect(HSOXO.x,HSOXO.y,HSOXO.width+1,HSOXO.height+1)
}
if(this.PgfBL.img_thumb.length>0)
{
YMmAF+="<div style=\"position:absolute;z-index:100;";
YMmAF+="left:"+HSOXO.x+"px;top:"+HSOXO.y+"px;\" >";
YMmAF+="<a href=\"javascript:"+kpPJk+"\" >";
YMmAF+="<img border=0 src='"+this.PgfBL.img_thumb+"' width='"+GTfdO.vSUSq.width+"px' height='"+GTfdO.vSUSq.height+"px'>"
YMmAF+="</a>"
YMmAF+="</div>"
}
YMmAF+=GTfdO.toHtml()
this.rwFPJ.push(GTfdO)
return YMmAF;
}
this.HouAQ=function()
{
for(var i=0;i<this.rwFPJ.length;i++)
{
var GTfdO=this.rwFPJ[i]
GTfdO.registerDynamicCanvas()
}
}
this.OiSqc=OiSqc;
this.id=OiSqc;
this.index=GBfTN
this.PgfBL=PgfBL;
this.market=fisYk;
this.jJNEo=fisYk.jJNEo
this.rwFPJ=new Array()
}
function NbleJ(Sexcm)
{
this.aggxQ=function()
{
var pMBpf="market-main-"+this.OiSqc
var FUDDF=html_getLayer(pMBpf)
var ZAmNr=this.tDRUI.products
var rmYmU=0;
var KdloL=0;
var YMmAF=""
var uuiFP=0;
var HcSfm=0;
var GpRbl=this.jJNEo.r_prod 
for(var i=0;i<ZAmNr.length;i++)
{
var PgfBL=ZAmNr[i]
var WnqRx=new jBSRa(this,PgfBL,i,this.OiSqc+"prod"+i)
PgfBL.obj=WnqRx
WnqRx.kkSSH=new Point(rmYmU,KdloL)
YMmAF+=WnqRx.dmcal()
HcSfm++;
if(HcSfm==this.jJNEo.cols)
{
HcSfm=0;
uuiFP++;
KdloL+=GpRbl.height
rmYmU=0;
}
else
{
rmYmU+=GpRbl.width
}
}
FUDDF.innerHTML=YMmAF
WA_exec_callback_opera_compliant(this,this.qVoCd)
}
this.qVoCd=function()
{
var ZAmNr=this.tDRUI.products
for(var i=0;i<ZAmNr.length;i++)
{
var PgfBL=ZAmNr[i]
PgfBL.obj.HouAQ()
}
}
this.struct=Sexcm;
this.Sexcm=Sexcm;
this.OiSqc=Sexcm.id;
this.id=Sexcm.id;
this.tDRUI=Sexcm.info
this.info=Sexcm.info
this.jJNEo=Sexcm.info.design
}
function WA_loadScriptDlgMarket(lqrkK,OiSqc,gDNsK)
{
if(document.wa_dlg_market_js_loaded==true)
{
KnMal([lqrkK,OiSqc,gDNsK])
return;
}
WA_Dialog.progress();
WA_loadScript('wa_dlg_emarket.js?v='+wa_global_market.id_modif_dlg_js,KnMal,[lqrkK,OiSqc,gDNsK]);
}
function WA_showMarketCart()
{
WA_loadScriptDlgMarket("show_cart") 
}
function WA_showMarketProduct(OiSqc,gDNsK)
{
WA_loadScriptDlgMarket("show_prod",OiSqc,gDNsK) 
}
function KnMal(HiFhK)
{
document.wa_dlg_market_js_loaded=true;
var lqrkK=HiFhK[0];
if(lqrkK=="show_cart") WA_displayDialogMarketCart()
if(lqrkK=="show_prod") WA_displayDialogMarketProduct(HiFhK[1],HiFhK[2])
}
function WA_getNumberMarketItemsInCart()
{
var WNMdr=parseInt(WA_GetCookie("crbst-card-nb_items"))
if(isNaN(WNMdr)) return 0;
return WNMdr;
}
function lktqc(lqrkK,jgrbf)
{
var FUDDF=html_getLayer(lqrkK)
if(FUDDF)
{
if(!jgrbf)jgrbf=Translator.tr("My card\u0020(%) article(s)");
var jMCQY=jgrbf
jMCQY=jMCQY.replace(/%/g,WA_getNumberMarketItemsInCart())
FUDDF.innerHTML=jMCQY
}
}
function WA_refreshNumberMarketItemsInCart()
{
for(var lqrkK in document.wa_global_button_market_declaration)
{
var jgrbf=document.wa_global_button_market_declaration[lqrkK]
if(lqrkK.indexOf("market-cart-link")==0)
{
lktqc(lqrkK,jgrbf)
}
else
{
var dGpNn=html_getLayer(lqrkK+"-div0"+"-text")
if(!dGpNn)dGpNn=lqrkK+"-div0"
var lCVdW=html_getLayer(lqrkK+"-div1"+"-text")
if(!lCVdW)lCVdW=lqrkK+"-div1"
lktqc(dGpNn,jgrbf)
lktqc(lCVdW,jgrbf)
}
}
}

-->
