<!--

function umHMR(GrZOX)
{
var LFSwC=GrZOX[0]
var eFwup=wa_global_market.markets[LFSwC]
var UbdVc=new DxrWC(eFwup)
eFwup.obj=UbdVc
UbdVc.rxeKt()
var UfKvE=document.wa_global_query_info
if(UfKvE)
{
if(LFSwC==UfKvE.m_unid)
{
WA_showMarketProduct(LFSwC,UfKvE.m_index_item)
return;
}
}
}
function WA_loadMarket()
{
for(var sTJxK in wa_global_market.markets)
{
var UbdVc=wa_global_market.markets[sTJxK]
if(UbdVc)
{
var qWWUb=Translator.m_lang_for_filename
if(qWWUb.length>0)qWWUb="_"+qWWUb;
WA_loadScript(UbdVc.src_folder+'/market-definition'+qWWUb+'.js?v='+UbdVc.id_modif,umHMR,[sTJxK]);
}
}
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 aMgKD=CONST_WA_GLOBAL_SETTINGS.currency_mnemonic
var result=WA_basicFormatPrice(v);
if(CONST_WA_GLOBAL_SETTINGS.currency_code=="GBP")
{
result=aMgKD+result;
}
else
if(CONST_WA_GLOBAL_SETTINGS.currency_code=="BRL")
{
result=aMgKD+" "+result;
}
else
{
result=result+" "+aMgKD;
}
return result;
}
function Gdrjb(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 tBAKS(UbdVc,lmQvG,ZSDjW,LFSwC)
{
this.NXbQk=function()
{
var mBKWx=""
var BlaFN=false;
var uRvUu="WA_showMarketProduct('"+UbdVc.LFSwC+"',"+ZSDjW+")"
BlaFN=new WA_GraphicElement(this.LFSwC+"-sep",60,false)
BlaFN.TPbXi=this.TPbXi
BlaFN.draw=function()
{
var TPbXi=this.TPbXi
var bEEMN=TPbXi.prod_global_separator_pt1
var unnXU=TPbXi.prod_global_separator_pt2
var TcRTJ=document.getElementById(this.canvasId())
var Vtfwi=TcRTJ.getContext('2d');
Vtfwi.strokeStyle=TPbXi.prod_global_separator_col
Gdrjb(Vtfwi,bEEMN.x-0.5,bEEMN.y+0.5,unnXU.x-0.5,unnXU.y+0.5,2)
Vtfwi.stroke()
}
BlaFN.setOnClick(uRvUu);
var UVVvT=this.TPbXi.r_prod_inner.clone()
UVVvT.translate(this.HkMvl.x,this.HkMvl.y)
BlaFN.setRect(UVVvT.x,UVVvT.y,UVVvT.width+1,UVVvT.height+1)
mBKWx+=BlaFN.toHtml()
this.cusDZ.push(BlaFN) 

BlaFN=new WA_GraphicElement(this.LFSwC+"-zone0",10,false)
BlaFN.TPbXi=this.TPbXi
BlaFN.draw=function()
{
var TPbXi=this.TPbXi
WA_bg(this.canvasId(),this.rect().width,this.rect().height,TPbXi.prod_global_corner,1,TPbXi.prod_global_border_col,[TPbXi.prod_global_gradient],this.shadow())
}
var UVVvT=this.TPbXi.r_prod_inner.clone()
UVVvT.translate(this.HkMvl.x,this.HkMvl.y)
BlaFN.setRect(UVVvT.x,UVVvT.y,UVVvT.width+1,UVVvT.height+1)
mBKWx+=BlaFN.toHtml()
this.cusDZ.push(BlaFN)
if(this.TPbXi.lay_rect_desc.isValid())
{


BlaFN=new WA_GraphicElement(this.LFSwC+"-zone1",25,false)
BlaFN.TPbXi=this.TPbXi
BlaFN.draw=function()
{
var TPbXi=this.TPbXi
WA_bg(this.canvasId(),this.rect().width,this.rect().height,TPbXi.prod_desc_corner,1,TPbXi.prod_desc_border_col,[TPbXi.prod_desc_gradient],this.shadow())
}
UVVvT=this.TPbXi.lay_rect_desc.clone()
UVVvT.translate(this.HkMvl.x,this.HkMvl.y)
BlaFN.setRect(UVVvT.x,UVVvT.y,UVVvT.width+1,UVVvT.height+1)
mBKWx+=BlaFN.toHtml()
this.cusDZ.push(BlaFN) 
UVVvT=this.TPbXi.lay_rect_desc_inner.clone()
UVVvT.translate(this.HkMvl.x,this.HkMvl.y)
mBKWx+="<div style=\"position:absolute;z-index:50;";
mBKWx+="left:"+UVVvT.x+"px;top:"+UVVvT.y+"px;";
mBKWx+="cursor:pointer;";
mBKWx+="width:"+UVVvT.width+"px;"
mBKWx+="height:"+UVVvT.height+"px;";
mBKWx+="font-family:"+this.TPbXi.prod_desc_font_family+";"
mBKWx+="font-size:"+this.TPbXi.prod_desc_font_size+"px;"
mBKWx+="color:"+this.TPbXi.prod_desc_col+";"
mBKWx+="margin:3px;"
mBKWx+="padding:0px;"
mBKWx+="\" ";
mBKWx+=">";
mBKWx+="<div style=\"";
mBKWx+="font-weight:bold;"
mBKWx+="\">";
mBKWx+=this.lmQvG.title
mBKWx+="</div>";
mBKWx+="<div style=\"";
mBKWx+="\">";
mBKWx+=this.lmQvG.sub_title
mBKWx+="</div>";
mBKWx+="</div>";
}
if(this.TPbXi.lay_rect_price.isValid())
{

BlaFN=new WA_GraphicElement(this.LFSwC+"-zone2",25,false)
BlaFN.TPbXi=this.TPbXi
BlaFN.draw=function()
{
var TPbXi=this.TPbXi
WA_bg(this.canvasId(),this.rect().width,this.rect().height,TPbXi.prod_price_corner,1,TPbXi.prod_price_border_col,[TPbXi.prod_price_gradient],this.shadow())
}
UVVvT=this.TPbXi.lay_rect_price.clone()
UVVvT.translate(this.HkMvl.x,this.HkMvl.y) 
BlaFN.setRect(UVVvT.x+1,UVVvT.y+1,UVVvT.width,UVVvT.height)
mBKWx+=BlaFN.toHtml()
this.cusDZ.push(BlaFN)
mBKWx+="<div style=\"position:absolute;z-index:50;";
mBKWx+="left:"+UVVvT.x+"px;top:"+UVVvT.y+"px;";
mBKWx+="width:"+UVVvT.width+"px;";
mBKWx+="height:"+UVVvT.height+"px;";
mBKWx+="line-height:"+UVVvT.height+"px;";
mBKWx+="font-family:"+this.TPbXi.prod_desc_font_family+";"
mBKWx+="font-size:"+this.TPbXi.prod_price_font_size+"px;"
mBKWx+="color:"+this.TPbXi.prod_price_col+";"
mBKWx+="text-align:center;"
mBKWx+="\">";
if(this.lmQvG.unavail)
{
mBKWx+="/" 
}
else
{
mBKWx+=WA_formatPrice(this.lmQvG.price)
}
mBKWx+="</div>";
}
if(this.TPbXi.lay_rect_img.isValid())
{

BlaFN=new WA_GraphicElement(this.LFSwC+"-zone3",25,this.TPbXi.img_has_shadow)
BlaFN.TPbXi=this.TPbXi
BlaFN.lmQvG=this.lmQvG
BlaFN.draw=function()
{
var TPbXi=this.TPbXi
var lmQvG=this.lmQvG
if(lmQvG.img_thumb.length>0)
{
if(this.shadow())
{
WA_bg(this.canvasId(),this.XTZbN.width,this.XTZbN.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)
}
}
UVVvT=this.TPbXi.lay_rect_img.clone()
UVVvT.translate(this.HkMvl.x,this.HkMvl.y)
if(this.lmQvG.img_thumb.length>0)
{
var ZbrwQ_thumb=new Size(UVVvT.width+1,UVVvT.height+1)
BlaFN.XTZbN=this.lmQvG.size_thumb.clone()
if(this.TPbXi.crop_thumb)
{
BlaFN.XTZbN=ZbrwQ_thumb
}
else
{
BlaFN.XTZbN.scale(ZbrwQ_thumb,true)
}
var PmwRW=Math.round((UVVvT.width-BlaFN.XTZbN.width)/2);
var lbRhx=Math.round((UVVvT.height-BlaFN.XTZbN.height)/2);
UVVvT.translate(PmwRW,lbRhx)
BlaFN.setRect(UVVvT.x,UVVvT.y,BlaFN.XTZbN.width,BlaFN.XTZbN.height)
}
else
{
BlaFN.setRect(UVVvT.x,UVVvT.y,UVVvT.width+1,UVVvT.height+1)
}
if(this.lmQvG.img_thumb.length>0)
{
mBKWx+="<div style=\"position:absolute;z-index:100;";
mBKWx+="left:"+UVVvT.x+"px;top:"+UVVvT.y+"px;\" >";
mBKWx+="<a href=\"javascript:"+uRvUu+"\" >";
mBKWx+="<img border=0 src='"+this.lmQvG.img_thumb+"' width='"+BlaFN.XTZbN.width+"px' height='"+BlaFN.XTZbN.height+"px'>"
mBKWx+="</a>"
mBKWx+="</div>"
}
mBKWx+=BlaFN.toHtml()
this.cusDZ.push(BlaFN)
}
return mBKWx;
}
this.cNDTx=function()
{
for(var i=0;i<this.cusDZ.length;i++)
{
var BlaFN=this.cusDZ[i]
BlaFN.registerDynamicCanvas()
}
}
this.LFSwC=LFSwC;
this.id=LFSwC;
this.index=ZSDjW
this.lmQvG=lmQvG;
this.market=UbdVc;
this.TPbXi=UbdVc.TPbXi
this.cusDZ=new Array()
}
function DxrWC(paiUw)
{
this.rxeKt=function()
{
var jsDDA="market-main-"+this.LFSwC
var ImWpj=html_getLayer(jsDDA)
var NsNbm=this.jRSWE.products
var vSJtC=0;
var TSuhv=0;
var mBKWx=""
var pjhFY=0;
var pINns=0;
var UviwX=this.TPbXi.r_prod 
for(var i=0;i<NsNbm.length;i++)
{
var lmQvG=NsNbm[i]
var AiGiW=new tBAKS(this,lmQvG,i,this.LFSwC+"prod"+i)
lmQvG.obj=AiGiW
AiGiW.HkMvl=new Point(vSJtC,TSuhv)
mBKWx+=AiGiW.NXbQk()
pINns++;
if(pINns==this.TPbXi.cols)
{
pINns=0;
pjhFY++;
TSuhv+=UviwX.height
vSJtC=0;
}
else
{
vSJtC+=UviwX.width
}
}
ImWpj.innerHTML=mBKWx
WA_exec_callback_opera_compliant(this,this.fIWXI)
}
this.fIWXI=function()
{
var NsNbm=this.jRSWE.products
for(var i=0;i<NsNbm.length;i++)
{
var lmQvG=NsNbm[i]
lmQvG.obj.cNDTx()
}
}
this.struct=paiUw;
this.paiUw=paiUw;
this.LFSwC=paiUw.id;
this.id=paiUw.id;
this.jRSWE=paiUw.info
this.info=paiUw.info
this.TPbXi=paiUw.info.design
}
function WA_loadScriptDlgMarket(QnQxe,LFSwC,bIrLH)
{
if(document.wa_dlg_market_js_loaded==true)
{
lgpsP([QnQxe,LFSwC,bIrLH])
return;
}
WA_Dialog.progress();
WA_loadScript('wa_dlg_emarket.js?v='+urlAntiCacheForPreview()+wa_global_market.id_modif_dlg_js,lgpsP,[QnQxe,LFSwC,bIrLH]);
}
function WA_showMarketCart()
{
WA_loadScriptDlgMarket("show_cart")
}
function WA_showMarketProduct(LFSwC,bIrLH)
{
WA_loadScriptDlgMarket("show_prod",LFSwC,bIrLH)
}
function lgpsP(GrZOX)
{
document.wa_dlg_market_js_loaded=true;
var QnQxe=GrZOX[0];
if(QnQxe=="show_cart") WA_displayDialogMarketCart()
if(QnQxe=="show_prod") WA_displayDialogMarketProduct(GrZOX[1],GrZOX[2])
}
function WA_getNumberMarketItemsInCart()
{
var bSiCf=parseInt(WA_GetCookie("crbst-card-nb_items"))
if(isNaN(bSiCf)) return 0;
return bSiCf;
}
function uLIqa(QnQxe,KlGJH)
{
var ImWpj=html_getLayer(QnQxe)
if(ImWpj)
{
if(!KlGJH)KlGJH=Translator.tr("My card\u0020(%) article(s)");
var IZLbO=KlGJH
IZLbO=IZLbO.replace(/%/g,WA_getNumberMarketItemsInCart())
ImWpj.innerHTML=IZLbO
}
}
function WA_refreshNumberMarketItemsInCart()
{
for(var QnQxe in document.wa_global_button_market_declaration)
{
var KlGJH=document.wa_global_button_market_declaration[QnQxe]
if(QnQxe.indexOf("market-cart-link")==0)
{
uLIqa(QnQxe,KlGJH)
}
else
{
var ipVDa=html_getLayer(QnQxe+"-div0"+"-text")
if(!ipVDa)ipVDa=QnQxe+"-div0"
var RqgLr=html_getLayer(QnQxe+"-div1"+"-text")
if(!RqgLr)RqgLr=QnQxe+"-div1"
uLIqa(ipVDa,KlGJH)
uLIqa(RqgLr,KlGJH)
}
}
}

-->
