<!--

function ParQC(GmTAk)
{
var AXeZv=GmTAk[0]
var RTgIq=wa_global_market.markets[AXeZv]
var AYFwI=new ncNbR(RTgIq)
RTgIq.obj=AYFwI
AYFwI.JBQei()
var bGbwi=document.wa_global_query_info
if(bGbwi)
{
if(AXeZv==bGbwi.m_unid)
{
WA_showMarketProduct(AXeZv,bGbwi.m_index_item)
return;
}
}
}
function WA_loadMarket()
{
for(var mfgfe in wa_global_market.markets)
{
var AYFwI=wa_global_market.markets[mfgfe]
if(AYFwI)
{
var HKWCd=Translator.m_lang_for_filename
if(HKWCd.length>0)HKWCd="_"+HKWCd;
WA_loadScript(AYFwI.src_folder+'/market-definition'+HKWCd+'.js?v='+AYFwI.id_modif,ParQC,[mfgfe]);
}
}
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 jUOae=''
try{jUOae=CONST_WA_GLOBAL_SETTINGS.currency_mnemonic}catch(e){}
if(CONST_WA_GLOBAL_SETTINGS.currency_code=="GBP")
{
result=jUOae+result;
}
else
{
result=result+" "+jUOae;
}
return result;
}
function gIlXl(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 FTBZm(AYFwI,rqaCi,ElxnQ,AXeZv)
{
this.RicwR=function()
{
var bRvBG=""
var mbTma=false;
var XNsZv="WA_showMarketProduct('"+AYFwI.AXeZv+"',"+ElxnQ+")"
mbTma=new WA_GraphicElement(this.AXeZv+"-sep",60,false)
mbTma.KBHmD=this.KBHmD
mbTma.draw=function()
{
var KBHmD=this.KBHmD
var jfKuh=KBHmD.prod_global_separator_pt1
var ipvSk=KBHmD.prod_global_separator_pt2
var REBot=document.getElementById(this.canvasId())
var DRRYh=REBot.getContext('2d');
DRRYh.strokeStyle=KBHmD.prod_global_separator_col
gIlXl(DRRYh,jfKuh.x+0.5,jfKuh.y+0.5,ipvSk.x+0.5,ipvSk.y+0.5,2)
DRRYh.stroke()
}
mbTma.setOnClick(XNsZv);
var ebjDr=this.KBHmD.r_prod_inner.clone()
ebjDr.translate(this.cTmKO.x,this.cTmKO.y)
mbTma.setRect(ebjDr.x,ebjDr.y,ebjDr.width+1,ebjDr.height+1)
bRvBG+=mbTma.toHtml()
this.uhAME.push(mbTma) 

mbTma=new WA_GraphicElement(this.AXeZv+"-zone0",10,false)
mbTma.KBHmD=this.KBHmD
mbTma.draw=function()
{
var KBHmD=this.KBHmD
WA_bg(this.canvasId(),this.rect().width,this.rect().height,KBHmD.prod_global_corner,1,KBHmD.prod_global_border_col,[KBHmD.prod_global_gradient],this.shadow()) 
}
var ebjDr=this.KBHmD.r_prod_inner.clone()
ebjDr.translate(this.cTmKO.x,this.cTmKO.y)
mbTma.setRect(ebjDr.x,ebjDr.y,ebjDr.width+1,ebjDr.height+1)
bRvBG+=mbTma.toHtml()
this.uhAME.push(mbTma) 

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

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

mbTma=new WA_GraphicElement(this.AXeZv+"-zone3",25,this.KBHmD.img_has_shadow)
mbTma.KBHmD=this.KBHmD
mbTma.rqaCi=this.rqaCi
mbTma.draw=function()
{
var KBHmD=this.KBHmD
var rqaCi=this.rqaCi
if(rqaCi.img_thumb.length>0)
{
if(this.shadow())
{
WA_bg(this.canvasId(),this.qfNcU_thumb.width,this.qfNcU_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)
}
}
ebjDr=this.KBHmD.lay_rect_img.clone()
ebjDr.translate(this.cTmKO.x,this.cTmKO.y)
if(this.rqaCi.img_thumb.length>0)
{
var XBZdt_thumb=new Size(ebjDr.width+1,ebjDr.height+1)
mbTma.qfNcU_thumb=this.rqaCi.size_thumb.clone()
if(this.KBHmD.crop_thumb)
{
mbTma.qfNcU_thumb=XBZdt_thumb
}
else
{
mbTma.qfNcU_thumb.scale(XBZdt_thumb,true)
}
var XmtUi=Math.round((ebjDr.width-mbTma.qfNcU_thumb.width)/2);
var SJMsP=Math.round((ebjDr.height-mbTma.qfNcU_thumb.height)/2);
ebjDr.translate(XmtUi,SJMsP)
mbTma.setRect(ebjDr.x,ebjDr.y,mbTma.qfNcU_thumb.width,mbTma.qfNcU_thumb.height)
}
else
{
mbTma.setRect(ebjDr.x,ebjDr.y,ebjDr.width+1,ebjDr.height+1)
}
if(this.rqaCi.img_thumb.length>0)
{
bRvBG+="<div style=\"position:absolute;z-index:100;";
bRvBG+="left:"+ebjDr.x+"px;top:"+ebjDr.y+"px;\" >";
bRvBG+="<img border=0 src='"+this.rqaCi.img_thumb+"' width='"+mbTma.qfNcU_thumb.width+"px' height='"+mbTma.qfNcU_thumb.height+"px'>" 
bRvBG+="</div>"
}
bRvBG+=mbTma.toHtml()
this.uhAME.push(mbTma)
return bRvBG;
}
this.unWtp=function()
{
for(var i=0;i<this.uhAME.length;i++)
{
var mbTma=this.uhAME[i]
mbTma.registerDynamicCanvas()
}
}
this.AXeZv=AXeZv;
this.id=AXeZv;
this.index=ElxnQ
this.rqaCi=rqaCi;
this.market=AYFwI;
this.KBHmD=AYFwI.KBHmD
this.uhAME=new Array()
}
function ncNbR(gjVNP)
{
this.JBQei=function()
{
var scUkK="market-main-"+this.AXeZv
var PNSSY=html_getLayer(scUkK)
var YXkFY=this.MnBkg.products
var JRjQU=0;
var sEjxj=0;
var bRvBG=""
var VWpUY=0;
var wIoKU=0;
var YBkbf=this.KBHmD.r_prod 
for(var i=0;i<YXkFY.length;i++)
{
var rqaCi=YXkFY[i]
var ahsmK=new FTBZm(this,rqaCi,i,this.AXeZv+"prod"+i)
rqaCi.obj=ahsmK
ahsmK.cTmKO=new Point(JRjQU,sEjxj)
bRvBG+=ahsmK.RicwR()
wIoKU++;
if(wIoKU==this.KBHmD.cols)
{
wIoKU=0;
VWpUY++;
sEjxj+=YBkbf.height
JRjQU=0;
}
else
{
JRjQU+=YBkbf.width
}
}
PNSSY.innerHTML=bRvBG
WA_exec_callback_opera_compliant(this,this.inGPb)
}
this.inGPb=function()
{
var YXkFY=this.MnBkg.products
for(var i=0;i<YXkFY.length;i++)
{
var rqaCi=YXkFY[i]
rqaCi.obj.unWtp()
}
}
this.struct=gjVNP;
this.gjVNP=gjVNP;
this.AXeZv=gjVNP.id;
this.id=gjVNP.id;
this.MnBkg=gjVNP.info
this.info=gjVNP.info
this.KBHmD=gjVNP.info.design
}
function WA_loadScriptDlgMarket(eSYeT,AXeZv,mXuiD)
{
if(document.wa_dlg_market_js_loaded==true)
{
FmGac([eSYeT,AXeZv,mXuiD])
return;
}
WA_Dialog.progress();
WA_loadScript('wa_dlg_emarket.js?v='+wa_global_market.id_modif_dlg_js,FmGac,[eSYeT,AXeZv,mXuiD]);
}
function WA_showMarketCart()
{
WA_loadScriptDlgMarket("show_cart") 
}
function WA_showMarketProduct(AXeZv,mXuiD)
{
WA_loadScriptDlgMarket("show_prod",AXeZv,mXuiD) 
}
function FmGac(GmTAk)
{
document.wa_dlg_market_js_loaded=true;
var eSYeT=GmTAk[0];
if(eSYeT=="show_cart") WA_displayDialogMarketCart()
if(eSYeT=="show_prod") WA_displayDialogMarketProduct(GmTAk[1],GmTAk[2])
}
function WA_getNumberMarketItemsInCart()
{
var siUwX=parseInt(WA_GetCookie("crbst-card-nb_items"))
if(isNaN(siUwX)) return 0;
return siUwX;
}
function VcZQp(eSYeT,jRhVw)
{
var PNSSY=html_getLayer(eSYeT)
if(PNSSY)
{
if(!jRhVw)jRhVw=Translator.tr("My card\u0020(%) article(s)");
var VlorP=jRhVw
VlorP=VlorP.replace(/%/g,WA_getNumberMarketItemsInCart())
PNSSY.innerHTML=VlorP
}
}
function WA_refreshNumberMarketItemsInCart()
{
for(var eSYeT in document.wa_global_button_market_declaration)
{
var jRhVw=document.wa_global_button_market_declaration[eSYeT]
if(eSYeT.indexOf("market-cart-link")==0)
{
VcZQp(eSYeT,jRhVw)
}
else
{
var tDHus=html_getLayer(eSYeT+"-div0"+"-text")
if(!tDHus)tDHus=eSYeT+"-div0"
var VJCRZ=html_getLayer(eSYeT+"-div1"+"-text")
if(!VJCRZ)VJCRZ=eSYeT+"-div1"
VcZQp(tDHus,jRhVw)
VcZQp(VJCRZ,jRhVw)
}
}
}

-->
