<!--

function LxETs(SiWVE)
{
var mRYUY=SiWVE[0]
var ZorIQ=wa_global_market.markets[mRYUY]
var hYuNk=new fSBJb(ZorIQ)
ZorIQ.obj=hYuNk
hYuNk.snAJA()
var uwgio=document.wa_global_query_info
if(uwgio)
{
if(mRYUY==uwgio.m_unid)
{
WA_showMarketProduct(mRYUY,uwgio.m_index_item)
return;
}
}
}
function WA_loadMarket()
{
for(var dlWxb in wa_global_market.markets)
{
var hYuNk=wa_global_market.markets[dlWxb]
if(hYuNk)
{
var imOPB=Translator.m_lang_for_filename
if(imOPB.length>0)imOPB="_"+imOPB;
WA_loadScript(hYuNk.src_folder+'/market-definition'+imOPB+'.js?v='+hYuNk.id_modif,LxETs,[dlWxb]);
}
}
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 eETRt=CONST_WA_GLOBAL_SETTINGS.currency_mnemonic
var result=WA_basicFormatPrice(v);
if(CONST_WA_GLOBAL_SETTINGS.currency_code=="GBP")
{
result=eETRt+result;
}
else
if(CONST_WA_GLOBAL_SETTINGS.currency_code=="BRL")
{
result=eETRt+" "+result;
}
else
{
result=result+" "+eETRt;
}
return result;
}
function rgpEE(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 kqfab(hYuNk,AtGUq,kcsMf,mRYUY)
{
this.bbtAJ=function()
{
var LKaer=""
var wGYil=false;
var rtUOl="WA_showMarketProduct('"+hYuNk.mRYUY+"',"+kcsMf+")"
wGYil=new WA_GraphicElement(this.mRYUY+"-sep",60,false)
wGYil.VDjDq=this.VDjDq
wGYil.draw=function()
{
var VDjDq=this.VDjDq
var ScbEN=VDjDq.prod_global_separator_pt1
var WGTrj=VDjDq.prod_global_separator_pt2
var UPGeu=document.getElementById(this.canvasId())
var xvKRj=UPGeu.getContext('2d');
xvKRj.strokeStyle=VDjDq.prod_global_separator_col
rgpEE(xvKRj,ScbEN.x-0.5,ScbEN.y+0.5,WGTrj.x-0.5,WGTrj.y+0.5,2)
xvKRj.stroke()
}
wGYil.setOnClick(rtUOl);
var oZDtg=this.VDjDq.r_prod_inner.clone()
oZDtg.translate(this.FAslM.x,this.FAslM.y)
wGYil.setRect(oZDtg.x,oZDtg.y,oZDtg.width+1,oZDtg.height+1)
LKaer+=wGYil.toHtml()
this.bckEh.push(wGYil) 

wGYil=new WA_GraphicElement(this.mRYUY+"-zone0",10,false)
wGYil.VDjDq=this.VDjDq
wGYil.draw=function()
{
var VDjDq=this.VDjDq
WA_bg(this.canvasId(),this.rect().width,this.rect().height,VDjDq.prod_global_corner,1,VDjDq.prod_global_border_col,[VDjDq.prod_global_gradient],this.shadow())
}
var oZDtg=this.VDjDq.r_prod_inner.clone()
oZDtg.translate(this.FAslM.x,this.FAslM.y)
wGYil.setRect(oZDtg.x,oZDtg.y,oZDtg.width+1,oZDtg.height+1)
LKaer+=wGYil.toHtml()
this.bckEh.push(wGYil)
if(this.VDjDq.lay_rect_desc.isValid())
{


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

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

wGYil=new WA_GraphicElement(this.mRYUY+"-zone3",25,this.VDjDq.img_has_shadow)
wGYil.VDjDq=this.VDjDq
wGYil.AtGUq=this.AtGUq
wGYil.draw=function()
{
var VDjDq=this.VDjDq
var AtGUq=this.AtGUq
if(AtGUq.img_thumb.length>0)
{
if(this.shadow())
{
WA_bg(this.canvasId(),this.DrEZi.width,this.DrEZi.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)
}
}
oZDtg=this.VDjDq.lay_rect_img.clone()
oZDtg.translate(this.FAslM.x,this.FAslM.y)
if(this.AtGUq.img_thumb.length>0)
{
var dACPs_thumb=new Size(oZDtg.width+1,oZDtg.height+1)
wGYil.DrEZi=this.AtGUq.size_thumb.clone()
if(this.VDjDq.crop_thumb)
{
wGYil.DrEZi=dACPs_thumb
}
else
{
wGYil.DrEZi.scale(dACPs_thumb,true)
}
var IRGts=Math.round((oZDtg.width-wGYil.DrEZi.width)/2);
var NmlKZ=Math.round((oZDtg.height-wGYil.DrEZi.height)/2);
oZDtg.translate(IRGts,NmlKZ)
wGYil.setRect(oZDtg.x,oZDtg.y,wGYil.DrEZi.width,wGYil.DrEZi.height)
}
else
{
wGYil.setRect(oZDtg.x,oZDtg.y,oZDtg.width+1,oZDtg.height+1)
}
if(this.AtGUq.img_thumb.length>0)
{
LKaer+="<div style=\"position:absolute;z-index:100;";
LKaer+="left:"+oZDtg.x+"px;top:"+oZDtg.y+"px;\" >";
LKaer+="<a href=\"javascript:"+rtUOl+"\" >";
LKaer+="<img border=0 src='"+this.AtGUq.img_thumb+"' width='"+wGYil.DrEZi.width+"px' height='"+wGYil.DrEZi.height+"px'>"
LKaer+="</a>"
LKaer+="</div>"
}
LKaer+=wGYil.toHtml()
this.bckEh.push(wGYil)
}
return LKaer;
}
this.cIDJt=function()
{
for(var i=0;i<this.bckEh.length;i++)
{
var wGYil=this.bckEh[i]
wGYil.registerDynamicCanvas()
}
}
this.mRYUY=mRYUY;
this.id=mRYUY;
this.index=kcsMf
this.AtGUq=AtGUq;
this.market=hYuNk;
this.VDjDq=hYuNk.VDjDq
this.bckEh=new Array()
}
function fSBJb(OcRkc)
{
this.snAJA=function()
{
var nWlpS="market-main-"+this.mRYUY
var XmgOY=html_getLayer(nWlpS)
var dHWMC=this.wmEnR.products
var RKRFV=0;
var GRibM=0;
var LKaer=""
var KTPMd=0;
var RHSZD=0;
var VPNHm=this.VDjDq.r_prod 
for(var i=0;i<dHWMC.length;i++)
{
var AtGUq=dHWMC[i]
var veWUF=new kqfab(this,AtGUq,i,this.mRYUY+"prod"+i)
AtGUq.obj=veWUF
veWUF.FAslM=new Point(RKRFV,GRibM)
LKaer+=veWUF.bbtAJ()
RHSZD++;
if(RHSZD==this.VDjDq.cols)
{
RHSZD=0;
KTPMd++;
GRibM+=VPNHm.height
RKRFV=0;
}
else
{
RKRFV+=VPNHm.width
}
}
XmgOY.innerHTML=LKaer
WA_exec_callback_opera_compliant(this,this.hFXBI)
}
this.hFXBI=function()
{
var dHWMC=this.wmEnR.products
for(var i=0;i<dHWMC.length;i++)
{
var AtGUq=dHWMC[i]
AtGUq.obj.cIDJt()
}
}
this.struct=OcRkc;
this.OcRkc=OcRkc;
this.mRYUY=OcRkc.id;
this.id=OcRkc.id;
this.wmEnR=OcRkc.info
this.info=OcRkc.info
this.VDjDq=OcRkc.info.design
}
function WA_loadScriptDlgMarket(baJPM,mRYUY,xtCoc)
{
if(document.wa_dlg_market_js_loaded==true)
{
OKRun([baJPM,mRYUY,xtCoc])
return;
}
WA_Dialog.progress();
WA_loadScript('wa_dlg_emarket.js?v='+wa_global_market.id_modif_dlg_js,OKRun,[baJPM,mRYUY,xtCoc]);
}
function WA_showMarketCart()
{
WA_loadScriptDlgMarket("show_cart") 
}
function WA_showMarketProduct(mRYUY,xtCoc)
{
WA_loadScriptDlgMarket("show_prod",mRYUY,xtCoc) 
}
function OKRun(SiWVE)
{
document.wa_dlg_market_js_loaded=true;
var baJPM=SiWVE[0];
if(baJPM=="show_cart") WA_displayDialogMarketCart()
if(baJPM=="show_prod") WA_displayDialogMarketProduct(SiWVE[1],SiWVE[2])
}
function WA_getNumberMarketItemsInCart()
{
var ikRAa=parseInt(WA_GetCookie("crbst-card-nb_items"))
if(isNaN(ikRAa)) return 0;
return ikRAa;
}
function gExhw(baJPM,SqJrv)
{
var XmgOY=html_getLayer(baJPM)
if(XmgOY)
{
if(!SqJrv)SqJrv=Translator.tr("My card\u0020(%) article(s)");
var AwoRE=SqJrv
AwoRE=AwoRE.replace(/%/g,WA_getNumberMarketItemsInCart())
XmgOY.innerHTML=AwoRE
}
}
function WA_refreshNumberMarketItemsInCart()
{
for(var baJPM in document.wa_global_button_market_declaration)
{
var SqJrv=document.wa_global_button_market_declaration[baJPM]
if(baJPM.indexOf("market-cart-link")==0)
{
gExhw(baJPM,SqJrv)
}
else
{
var PTarf=html_getLayer(baJPM+"-div0"+"-text")
if(!PTarf)PTarf=baJPM+"-div0"
var ECiCG=html_getLayer(baJPM+"-div1"+"-text")
if(!ECiCG)ECiCG=baJPM+"-div1"
gExhw(PTarf,SqJrv)
gExhw(ECiCG,SqJrv)
}
}
}

-->
