<!--

function TvmYY(bEfMX)
{
var IYBOa=bEfMX[0]
var baGfk=wa_global_market.markets[IYBOa]
var WkGXH=new kwfUw(baGfk)
baGfk.obj=WkGXH
WkGXH.TYfsX()
var sbMeL=document.wa_global_query_info
if(sbMeL)
{
if(IYBOa==sbMeL.m_unid)
{
WA_showMarketProduct(IYBOa,sbMeL.m_index_item)
return;
}
}
}
function WA_loadMarket()
{
for(var VFYQL in wa_global_market.markets)
{
var WkGXH=wa_global_market.markets[VFYQL]
if(WkGXH)
{
var vwkKB=Translator.m_lang_for_filename
if(vwkKB.length>0)vwkKB="_"+vwkKB;
WA_loadScript(WkGXH.src_folder+'/market-definition'+vwkKB+'.js?v='+WkGXH.id_modif,TvmYY,[VFYQL]);
}
}
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 MmHuV=''
try{MmHuV=CONST_WA_GLOBAL_SETTINGS.currency_mnemonic}catch(e){}
if(CONST_WA_GLOBAL_SETTINGS.currency_code=="GBP")
{
result=MmHuV+result;
}
else
{
result=result+" "+MmHuV;
}
return result;
}
function UrTuH(WkGXH,kXgal,aMtie,IYBOa)
{
this.YTdOV=function()
{
var dJLOW=""
var aMqAc=false;
var SJvAD="WA_showMarketProduct('"+WkGXH.IYBOa+"',"+aMtie+")" 
aMqAc=new WA_GraphicElement(this.IYBOa+"-zone0",10,false)
aMqAc.BquLY=this.BquLY
aMqAc.draw=function()
{
var BquLY=this.BquLY
WA_bg(this.canvasId(),this.rect().width,this.rect().height,BquLY.prod_global_corner,1,BquLY.prod_global_border_col,[BquLY.prod_global_gradient],this.shadow())
}
var kSJtD=this.BquLY.r_prod_inner.clone()
kSJtD.translate(this.EjUIj.x,this.EjUIj.y)
aMqAc.setRect(kSJtD.x,kSJtD.y,kSJtD.width+1,kSJtD.height+1)
dJLOW+=aMqAc.toHtml()
this.pZIxe.push(aMqAc) 

aMqAc=new WA_GraphicElement(this.IYBOa+"-zone1",25,false)
aMqAc.BquLY=this.BquLY
aMqAc.draw=function()
{
var BquLY=this.BquLY
WA_bg(this.canvasId(),this.rect().width,this.rect().height,BquLY.prod_desc_corner,1,BquLY.prod_desc_border_col,[BquLY.prod_desc_gradient],this.shadow())
}
kSJtD=this.BquLY.lay_rect_desc.clone()
kSJtD.translate(this.EjUIj.x,this.EjUIj.y)
aMqAc.setRect(kSJtD.x,kSJtD.y,kSJtD.width+1,kSJtD.height+1)
dJLOW+=aMqAc.toHtml()
this.pZIxe.push(aMqAc) 
kSJtD=this.BquLY.lay_rect_desc_inner.clone()
kSJtD.translate(this.EjUIj.x,this.EjUIj.y)
dJLOW+="<div style=\"position:absolute;z-index:50;";
dJLOW+="left:"+kSJtD.x+"px;top:"+kSJtD.y+"px;";
dJLOW+="cursor:pointer;";
dJLOW+="width:"+kSJtD.width+"px;"
dJLOW+="height:"+kSJtD.height+"px;";
dJLOW+="font-family:"+this.BquLY.prod_desc_font_family+";"
dJLOW+="font-size:"+this.BquLY.prod_desc_font_size+"px;"
dJLOW+="color:"+this.BquLY.prod_desc_col+";"
dJLOW+="\" onclick=\""+SJvAD+"\" ";
dJLOW+=">";
dJLOW+="<div style=\"";
dJLOW+="font-weight:bold;"
dJLOW+="\">";
dJLOW+=this.kXgal.title
dJLOW+="</div>";
dJLOW+="<div style=\"";
dJLOW+="\">";
dJLOW+=this.kXgal.sub_title
dJLOW+="</div>";
dJLOW+="</div>";

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

aMqAc=new WA_GraphicElement(this.IYBOa+"-zone3",25,this.BquLY.img_has_shadow)
aMqAc.BquLY=this.BquLY
aMqAc.kXgal=this.kXgal
aMqAc.draw=function()
{
var BquLY=this.BquLY
var kXgal=this.kXgal
if(kXgal.img_thumb.length>0)
{
if(this.shadow())
{
WA_bg(this.canvasId(),this.mgPFn_thumb.width,this.mgPFn_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)
}
}
kSJtD=this.BquLY.lay_rect_img.clone()
kSJtD.translate(this.EjUIj.x,this.EjUIj.y)
if(this.kXgal.img_thumb.length>0)
{
var WHmqX_thumb=new Size(kSJtD.width+1,kSJtD.height+1)
aMqAc.mgPFn_thumb=this.kXgal.size_thumb.clone()
if(this.BquLY.crop_thumb)
{
aMqAc.mgPFn_thumb=WHmqX_thumb
}
else
{
aMqAc.mgPFn_thumb.scale(WHmqX_thumb,true)
}
var NarFa=Math.round((kSJtD.width-aMqAc.mgPFn_thumb.width)/2);
var eYSRI=Math.round((kSJtD.height-aMqAc.mgPFn_thumb.height)/2);
kSJtD.translate(NarFa,eYSRI)
aMqAc.setRect(kSJtD.x,kSJtD.y,aMqAc.mgPFn_thumb.width,aMqAc.mgPFn_thumb.height)
}
else
{
aMqAc.setRect(kSJtD.x,kSJtD.y,kSJtD.width+1,kSJtD.height+1)
}
if(this.kXgal.img_thumb.length>0)
{
dJLOW+="<div style=\"position:absolute;z-index:100;";
dJLOW+="left:"+kSJtD.x+"px;top:"+kSJtD.y+"px;\" ><a href=\"javascript:"+SJvAD+"\" >";
dJLOW+="<img border=0 src='"+this.kXgal.img_thumb+"' width='"+aMqAc.mgPFn_thumb.width+"px' height='"+aMqAc.mgPFn_thumb.height+"px'>"
dJLOW+="</a></div>"
}
aMqAc.setOnClick(SJvAD);
dJLOW+=aMqAc.toHtml()
this.pZIxe.push(aMqAc)
return dJLOW;
}
this.Siind=function()
{
for(var i=0;i<this.pZIxe.length;i++)
{
var aMqAc=this.pZIxe[i]
aMqAc.registerDynamicCanvas()
}
}
this.IYBOa=IYBOa;
this.id=IYBOa;
this.index=aMtie
this.kXgal=kXgal;
this.market=WkGXH;
this.BquLY=WkGXH.BquLY
this.pZIxe=new Array()
}
function kwfUw(kdwNr)
{
this.TYfsX=function()
{
var BuShP="market-main-"+this.IYBOa
var vqHVG=html_getLayer(BuShP)
var fajRb=this.IEPbT.products
var DeUGP=0;
var EAxjC=0;
var dJLOW=""
var vZQNg=0;
var QUTuP=0;
var Iheks=this.BquLY.r_prod
for(var i=0;i<fajRb.length;i++)
{
var kXgal=fajRb[i]
var gTgtt=new UrTuH(this,kXgal,i,this.IYBOa+"prod"+i)
kXgal.obj=gTgtt
gTgtt.EjUIj=new Point(DeUGP,EAxjC)
dJLOW+=gTgtt.YTdOV()
QUTuP++;
if(QUTuP==this.BquLY.cols)
{
QUTuP=0;
vZQNg++;
EAxjC+=Iheks.height
DeUGP=0;
}
else
{
DeUGP+=Iheks.width
}
}
vqHVG.innerHTML=dJLOW
WA_exec_callback_opera_compliant(this,this.dgEqI)
}
this.dgEqI=function()
{
var fajRb=this.IEPbT.products
for(var i=0;i<fajRb.length;i++)
{
var kXgal=fajRb[i]
kXgal.obj.Siind()
}
}
this.struct=kdwNr;
this.kdwNr=kdwNr;
this.IYBOa=kdwNr.id;
this.id=kdwNr.id;
this.IEPbT=kdwNr.info
this.info=kdwNr.info
this.BquLY=kdwNr.info.design
}
function WA_loadScriptDlgMarket(RfaAB,IYBOa,sZvcx)
{
if(document.wa_dlg_market_js_loaded==true)
{
mJgug([RfaAB,IYBOa,sZvcx])
return;
}
WA_Dialog.progress();
WA_loadScript('wa_dlg_emarket.js?v='+wa_global_market.id_modif_dlg_js,mJgug,[RfaAB,IYBOa,sZvcx]);
}
function WA_showMarketCart()
{
WA_loadScriptDlgMarket("show_cart") 
}
function WA_showMarketProduct(IYBOa,sZvcx)
{
WA_loadScriptDlgMarket("show_prod",IYBOa,sZvcx) 
}
function mJgug(bEfMX)
{
document.wa_dlg_market_js_loaded=true;
var RfaAB=bEfMX[0];
if(RfaAB=="show_cart") WA_displayDialogMarketCart()
if(RfaAB=="show_prod") WA_displayDialogMarketProduct(bEfMX[1],bEfMX[2])
}
function WA_getNumberMarketItemsInCart()
{
var vldDd=parseInt(WA_GetCookie("crbst-card-nb_items"))
if(isNaN(vldDd)) return 0;
return vldDd;
}
function EZECN(RfaAB,BJKDi)
{
var vqHVG=html_getLayer(RfaAB)
if(vqHVG)
{
if(!BJKDi)BJKDi=Translator.tr("My card\u0020(%) article(s)");
var SBiBc=BJKDi
SBiBc=SBiBc.replace(/%/g,WA_getNumberMarketItemsInCart())
vqHVG.innerHTML=SBiBc
}
}
function WA_refreshNumberMarketItemsInCart()
{
for(var RfaAB in document.wa_global_button_market_declaration)
{
var BJKDi=document.wa_global_button_market_declaration[RfaAB]
if(RfaAB.indexOf("market-cart-link")==0)
{
EZECN(RfaAB,BJKDi)
}
else
{
var vYDnq=html_getLayer(RfaAB+"-div0"+"-text")
if(!vYDnq)vYDnq=RfaAB+"-div0"
var GaukW=html_getLayer(RfaAB+"-div1"+"-text")
if(!GaukW)GaukW=RfaAB+"-div1"
EZECN(vYDnq,BJKDi)
EZECN(GaukW,BJKDi)
}
}
}

-->
