<!--

waJSQuery(window).load(function(){
initializeAllWA_search();
});
function initializeAllWA_search()
{
waJSQuery(".wa-search-engine").each(function(i)
{
var mAjfk=waJSQuery(this);
var wVvRG=false;
if(isWebKit()==true)
{
wVvRG=true
}
if(wVvRG)
{
var fjPev=mAjfk.html();
fjPev=fjPev.replace(/type="text"/gi,"type=\"search\"")
mAjfk.html(fjPev)
}
var gIqbP=mAjfk.find("button")
var JowVc=mAjfk.find("input")
JowVc.attr("results","0");
JowVc.attr("placeholder","");
if(isWindowsOS()&&((BrowserDetect.browser=="Chrome")||(BrowserDetect.browser=="Safari")))
{
var uIUfU=JowVc.height();
uIUfU=Math.max(uIUfU,22)
JowVc.css({"height":""+uIUfU+"px"})
}
var LAOrm=(mAjfk.height()-JowVc.outerHeight())/2
JowVc.css("top",LAOrm) 
JowVc.keypress(function(e){
if(e.which=='13')
{
CsvNS(JowVc)
}
});
var NwniJ=gIqbP.parent();
NwniJ.css("cursor","pointer")
gIqbP.css("cursor","pointer")
NwniJ.click(function()
{
CsvNS(JowVc) 
});
if(wVvRG)
{
waActivateOverButton(NwniJ)
}
});
}
function WA_declareSearchIndex(CHJld)
{
document.const_wa_search_index_js=CHJld
}
function CsvNS(JowVc)
{
WA_openSearchDialog(JowVc,document.const_wa_search_index_js)
}
function kumVd(kfrJV)
{
document.wa_search_index_js_loaded=true;
var aXOjt=kfrJV[0]
veVai();
aXOjt.miMmL=false;
aXOjt.aOtkB()
}
function WA_onClickSearch()
{
var aXOjt=WA_Dialog.getCurrent()
if(!aXOjt)return;
if(aXOjt.miMmL==true) return;
aXOjt.fQskL=waJSQuery("#"+aXOjt.KBpAQ+" ").val()
aXOjt.aOtkB()
}
function oWXSo(JowVc)
{
var oFVEn=window.CONST_WA_SEARCH_INDEX2
var JowVc_value=JowVc.val()
var pjfOJ=JowVc_value;
pjfOJ=removeAccentsFromString(pjfOJ);
pjfOJ=waJSQuery.trim(pjfOJ);
var xhPhZ=[",",";","\\.","'",":","/","`","\\?"];
for(var c=0;c<xhPhZ.length;c++)
{
var reg=new RegExp(xhPhZ[c],"g");
pjfOJ=pjfOJ.replace(reg," ")
}
var GsDdN=pjfOJ.toLowerCase().split(" ");
var pLlIN=new Array();
for(var i=0;i<GsDdN.length;i++)
{
var w=waJSQuery.trim(GsDdN[i]);
if(w!=undefined)
{
var Ymdjt=Number(w);
if(isNaN(Ymdjt))
{
if(w.length>=oFVEn.min_lenght_word) pLlIN.push(w);
}
else
{
if(w.length>=oFVEn.min_lenght_number) pLlIN.push(w);
}
}
}
pLlIN=pLlIN.sort(wdkxi);
var njdOG_search=new Array()
for(var i=0;i<pLlIN.length;i++)
{
var w=pLlIN[i];
var tVdfJ=""
for(var i2=0;i2<w.length;i2++)
{
var fjPev=w.charCodeAt(i2);
if(((fjPev>125)&&(fjPev<255))||(fjPev==38)||(fjPev=='<')||(fjPev=='>')||(fjPev=='"'))
{
}
else
{
tVdfJ+=w.charAt(i2);
}
}
njdOG_search.push(tVdfJ);
}
var PZDGA=new Array();
for(var i=0;i<njdOG_search.length;i++)
{
var aXOjt=njdOG_search[i];
var TltIa=true;
for(var i2=i+1;i2<njdOG_search.length;i2++)
{
var tVdfJ=njdOG_search[i2];
if(tVdfJ.indexOf(aXOjt)>-1)
{
TltIa=false;
break;
}
}
if(TltIa) PZDGA.push(aXOjt);
}
return PZDGA;
}
function WA_openSearchDialog(JowVc,CHJld)
{
var aXOjt=new WA_Dialog();
aXOjt.qvYIo=JowVc
aXOjt.cXHjq=40;
aXOjt.fQskL="-1"
aXOjt.kHcxx=function(JowVc_value)
{
this.cgIJL='search-dialog-input'
this.KBpAQ='search-dialog-select-filter'
this.erfda_windows_title_result="wa-result-windows-title"
this.IxSrc="wa-result-windows"
var bvCHh="rgba(0,0,0,0.5)"
var mAGGq="font-weight:bold;font-size:12px;"
this.initializeWindow(600,500)
var SPNnN=""
SPNnN+="<table border=0 cellpadding=0 cellspacing=0  style='width:100%;'>";
SPNnN+="<tr><td align=left style='"+mAGGq+"'>"
SPNnN+="<input type=text results=0 placeholder='' id='"+this.cgIJL+"' >&nbsp;&nbsp;"
SPNnN+="<input type=button value='"+Translator.tr("Search")+"' onclick='WA_onClickSearch()'>"
SPNnN+="&nbsp;&nbsp;" 
SPNnN+="<span id='search-filter-select' ></span>"
SPNnN+="<br><br>"
SPNnN+="</td>"
SPNnN+="</tr>";
SPNnN+="</table>"
SPNnN+="<div id='"+this.erfda_windows_title_result+"' style='"
SPNnN+="font-family:Arial;color:#ffffff;font-weight:bold;text-align:right;font-size:13px;";
SPNnN+="height:20px;line-height:20px;width:100%;"
SPNnN+="' ></div>"
SPNnN+="<div id='"+this.IxSrc+"' style='";
SPNnN+="position:relative;overflow:auto;"
SPNnN+="border-style:solid;border-width:1px;border-color:"+bvCHh+";"
SPNnN+="background-color:#ffffff;width:10px;height:10px;'></div>"
this.writeContent(SPNnN)
waJSQuery("#"+this.erfda_windows_title_result).css({"backgroundColor":"#000000","opacity":0.5}) 
this.customUpdate()
waJSQuery("#"+this.cgIJL).val(JowVc_value)
}
aXOjt.OHrjA=function(s)
{
var njdOG_search=this.njdOG_query
var title_ref=s;
var title2=removeAccentsFromString(title_ref.toLowerCase());
var result=title_ref;
var result2=title2;
for(var i=0;i<njdOG_search.length;i++)
{
var w=waJSQuery.trim(njdOG_search[i]);
var len_w=w.length;
if(len_w>1)
{
var nb=0;
var ind0=0;
var ind_search=0;
var ind=0;
do
{
ind=result2.indexOf(w,ind_search);
if(ind>-1)
{
var index_1=ind+len_w;
var s0=result.substring(ind0,ind);
var sw=result.substring(ind,ind+len_w);
var s1=result.substring(index_1);
var s2_0=result2.substring(ind0,ind);
var s2_1=result2.substring(index_1);
result=s0+"<b>"+sw+"</b>"+s1;
result2=s2_0+"<b>"+w+"</b>"+s2_1;
ind_search=index_1+7;
}
nb++;
}
while(ind>0);
}
}
return result;
}
aXOjt.DuZZh=function(kfrJV)
{
var QwYMs=waJSQuery("#search-filter-select")
var oFVEn=window.CONST_WA_SEARCH_INDEX2
var ZpWsI=0;
if(kfrJV.hasPagesIndex==true) ZpWsI++;
if(kfrJV.hasMarketItemIndex==true) ZpWsI++;
if(kfrJV.hasImagesIndex==true) ZpWsI++;
if(ZpWsI<=1)
{
QwYMs.html("")
return;
}
QwYMs.data("initialized",true)
var SPNnN=""
SPNnN+="<select id='"+this.KBpAQ+"' onchange='WA_onClickSearch()'>"
SPNnN+="<option value='-1' "+((this.fQskL=="-1")?"selected":"")+">"+Translator.tr("All results")+"</option>"
if(kfrJV.hasPagesIndex==true)
{
SPNnN+="<option value='0'"+((this.fQskL=="0")?"selected":"")+">"+Translator.tr("Pages results")+"</option>"
}
if(kfrJV.hasImagesIndex==true)
{
SPNnN+="<option value='2'"+((this.fQskL=="2")?"selected":"")+">"+Translator.tr("Photos results")+"</option>"
}
if(kfrJV.hasMarketItemIndex==true)
{
SPNnN+="<option value='1'"+((this.fQskL=="1")?"selected":"")+">"+Translator.tr("Articles results")+"</option>"
}
SPNnN+="</select>"
QwYMs.html(SPNnN)
}
aXOjt.pqBDM=function(SPNnN)
{
waJSQuery("#"+this.erfda_windows_title_result).html(SPNnN+"&nbsp;")
}
aXOjt.closeWin=function()
{
this.qvYIo.focus()
this.intern_closeWin()
}
aXOjt.onCustomKeypress=function(avrhC)
{
if(avrhC==13)
{
this.aOtkB()
return true;
}

return false;
}
aXOjt.customUpdate=function()
{
waJSQuery("#"+this.IxSrc).css({width:this.m_content_lx-2,height:this.m_content_ly-63})
}
aXOjt.UqIdt=function(SPNnN)
{
waJSQuery("#"+this.IxSrc).html(SPNnN)
}
aXOjt.keDTc=function(faigv,HMHHG,jchSo,CArrW,PxFOj,ZDJdN)
{
if(HMHHG.length==0)
{
HMHHG="Untitled"
}
else
{
HMHHG=this.OHrjA(HMHHG)
}
var VHoww="color:#212121;text-decoration:underline;font-size:15px;";
var bxvmo="color:#000000;font-size:13px;";
var iiPbD="color:#999999;font-size:13px;";
var wiRfn="color:#990099;font-size:12px;";
var SPNnN=""
SPNnN+="<table border=0 width=100% cellspacing=0 cellpadding=0>"
SPNnN+="<tr>"
if(PxFOj.length>0)
{
SPNnN+="<td align=center valign=top width="+this.cXHjq+"px style=''>"
SPNnN+=PxFOj
SPNnN+="</td>"
}
SPNnN+="<td"
if(PxFOj.length==0)
{
SPNnN+="colspan=2"
}
SPNnN+=">"
SPNnN+="<a style='"+VHoww+"' href='"+CArrW+"'>"+HMHHG+"</a>";
SPNnN+="<br>";
if(jchSo.length>0)
{
SPNnN+="<span style='"+bxvmo+"'>"+this.OHrjA(jchSo)+"</span><br>";
}
SPNnN+="<a style='"+iiPbD+"' href='"+CArrW+"'>"+CArrW+"</a>";
SPNnN+="</td>"
SPNnN+="</tr>"
SPNnN+="</table >";
return SPNnN;
}
aXOjt.QWBVx=function(wopvT,xDgwY,ZYmpO,nLQWM,SUDkX,i,ZDJdN)
{
var Cwwig=this
waJSQuery.getJSON(ZYmpO,{},function(PmATe)
{
var rngHD=PmATe.products[i]
var CArrW=xDgwY.url+"?wa_key="+"wa_"+wopvT.info.p+"/market_"+wopvT.info.id
var PxFOj=""
var xxJep=Cwwig.cXHjq;
if(rngHD.img_thumb.length>0)
{
var ZbLTP=new Size(rngHD.size_thumb[0],rngHD.size_thumb[1]);
ZbLTP.scale(new Size(xxJep,xxJep),true)
PxFOj="<img src=\""+rngHD.img_thumb+"\" width=\""+ZbLTP.width()+"px\" height=\""+ZbLTP.height()+"px\" border=0 style='margin-right:10px;'>"
}
var xpQZw=Cwwig.keDTc(i,rngHD.title,rngHD.sub_title,CArrW,PxFOj,ZDJdN)
SUDkX.html(xpQZw)
});
}
aXOjt.NnUff=function(wopvT,xDgwY,ZYmpO,jPadm,SUDkX,i,ZDJdN)
{
var Cwwig=this
waJSQuery.getJSON(ZYmpO,{},function(PmATe)
{
var rngHD=PmATe.images[i]
var PxFOj=""
var xxJep=Cwwig.cXHjq;
var nwTbQ=new Size(xxJep,xxJep)
var ZbLTP=null
var iJUMQ=PmATe.global_config.gallery_type
var jCfJB="th_"
if(iJUMQ==0)
{
ZbLTP=nwTbQ
}
if((iJUMQ==1)&&(PmATe.global_config.open_popup_when_clicking==1))
{
jCfJB="big_"
ZbLTP=new Size(rngHD.size.w,rngHD.size.h);
ZbLTP.scale(nwTbQ,true)
}
PxFOj="<img src=\""+jPadm+"/"+jCfJB+rngHD.fn+"\" width=\""+ZbLTP.width()+"px\" height=\""+ZbLTP.height()+"px\" border=0 style='margin-right:10px;'>"
var CArrW=xDgwY.url+"?wa_key="+"wa_"+wopvT.info.p+"/pa_"+wopvT.info.id
var xpQZw=Cwwig.keDTc(i,rngHD.comment,"",CArrW,PxFOj,ZDJdN)
SUDkX.html(xpQZw)
});
}
aXOjt.aOtkB=function()
{
var oFVEn=window.CONST_WA_SEARCH_INDEX2
if(oFVEn==undefined) return;
var XVqhN=oFVEn.page_info
var nQtBN=this.fQskL
if(nQtBN==undefined)nQtBN=""
var JowVc=waJSQuery("#"+this.cgIJL)
this.qvYIo.val(JowVc.val()) 
var njdOG_query=oWXSo(JowVc)
this.njdOG_query=njdOG_query;
var FVPaZ={}
var eFhwl=KgiTq(njdOG_query,nQtBN,FVPaZ)
if(eFhwl==undefined) return;
var SPNnN=""
var aIIfN="font-family:Arial;";
var VHoww="color:#212121;text-decoration:underline;font-size:15px;";
var bxvmo="color:#000000;font-size:13px;";
var iiPbD="color:#999999;font-size:13px;";
var wiRfn="color:#990099;font-size:12px;";
var l_image=40;
for(var i=0;i<eFhwl.length;i++)
{
var uEeEG=eFhwl[i]
var OKIgL=uEeEG.OKIgL;
var wopvT=OKIgL.objResult;
var xDgwY=XVqhN[wopvT.p];
var HMHHG=xDgwY.title
var desc=xDgwY.desc
var url=xDgwY.url
if(HMHHG==undefined) HMHHG=""
if(desc==undefined) desc=""
if(url==undefined) url=""
if(wopvT.typ==0)
{
}
if(wopvT.typ==1)
{
desc="market "+xDgwY.info
url="market?item="+xDgwY.info 
}
if(wopvT.typ==2)
{
desc="img "+xDgwY.info 
}
var KoFoK=desc;

var jdXcu=""
if(i%2==0)
{
jdXcu="background-color:#f3f3f3;"
}
SPNnN+="<div id='search_item-"+i+"' style='padding:5px;"+jdXcu+"'>"
if(wopvT.typ==0)
{
if(HMHHG.length==0)
{
HMHHG=url;
}
SPNnN+=this.keDTc(i,HMHHG,KoFoK,url,"",OKIgL.scoring)
}
else
{
SPNnN+="item "+xDgwY.info;
}
SPNnN+="</div>"
}
this.UqIdt(SPNnN) 
if(eFhwl.length==0)
{
if((this.njdOG_query.length==0)&&(JowVc.val().length>0))
{
this.pqBDM(Translator.tr("Type words with more characters"))
}
else
{
this.pqBDM(Translator.tr("No results"))
}
}
else
{
this.pqBDM(Translator.tr("Search result")+" : "+eFhwl.length)
}
if(eFhwl.length>0)
{
var osXFC=waJSQuery("#"+this.IxSrc) 
for(var i=0;i<eFhwl.length;i++)
{
var uEeEG=eFhwl[i] 
var OKIgL=uEeEG.OKIgL;
var objResult=OKIgL.objResult;
var LofWt=objResult.info 
var xDgwY=oFVEn.page_info[objResult.p]
if(objResult.typ!=0)
{
var SUDkX=osXFC.find("#search_item-"+i)
var VPQMj=LofWt.id
var KrZDv=-1;
var rrtHx=VPQMj.lastIndexOf("-");
if(rrtHx>-1)
{
KrZDv=parseInt(VPQMj.substring(rrtHx+1))
VPQMj=VPQMj.substring(0,rrtHx)
}
var FifuJ=Translator.m_lang_for_filename;
if(FifuJ.length>0)
{
FifuJ="_"+FifuJ
}
if(objResult.typ==1)
{
var ZYmpO="wa_"+LofWt.p+"/market_"+VPQMj+"/";
ZYmpO+="market-definition"+FifuJ+".js";
var nLQWM="wa_"+LofWt.p+"/market_"+VPQMj
this.QWBVx(objResult,xDgwY,ZYmpO,nLQWM,SUDkX,KrZDv,OKIgL.scoring)
}
if(objResult.typ==2)
{
var ZYmpO="wa_"+LofWt.p+"/pa_"+VPQMj+"/";
ZYmpO+="photo-album-definition"+FifuJ+".js";
var jPadm="wa_"+LofWt.p+"/pa_"+VPQMj
this.NnUff(objResult,xDgwY,ZYmpO,jPadm,SUDkX,KrZDv,OKIgL.scoring)
}
}
}
}
this.DuZZh(FVPaZ);
JowVc.focus()
}
aXOjt.kHcxx(JowVc.val())
if(document.wa_search_index_js_loaded==true)
{
aXOjt.aOtkB()
}
else
{
aXOjt.miMmL=true;
aXOjt.pqBDM("Loading search index...")
aXOjt.UqIdt("<div align=center style='padding:20px;'>"+htmlDynamicLoader(true,100,100)+"</div>")
WA_loadScript(CHJld,kumVd,[aXOjt])
}
waActivateDynamicLoader(waJSQuery("#"+aXOjt.IxSrc),true)
}
function KgiTq(njdOG_query,nQtBN,ljvvk)
{
var oFVEn=window.CONST_WA_SEARCH_INDEX2
if(oFVEn==undefined) return
var ewPUv=false;
var bnWFM=false;
var MLQLl=false;
var OIbFP=false;
var UpfdB=new Array() 
var nDebug=0;
var DiWZF=oFVEn.index
var WvSZI=oFVEn.result_items
var XVqhN=oFVEn.page_info 
var njdOG_search=njdOG_query
for(var i=0;i<njdOG_search.length;i++)
{
var w=njdOG_search[i];
if(w.length>0)
{
UpfdB=new Array();
for(var index in DiWZF)
{
var SEOUk_match_search=index.indexOf(w);
if(SEOUk_match_search!=-1)
{
var list_refs=DiWZF[index];
for(var saCQP_result in list_refs)
{
var IIjnU=list_refs[saCQP_result];
var QgEYD=IIjnU[0] 
var ZDJdN=IIjnU[1] 


var wopvT=WvSZI[QgEYD];
var MrAfl=false;
if((nQtBN=="-1")||(nQtBN=="")) MrAfl=true;
if(nQtBN=="0") MrAfl=(wopvT.typ==0);
if(nQtBN=="1") MrAfl=(wopvT.typ==1);
if(nQtBN=="2") MrAfl=(wopvT.typ==2);
if(wopvT.typ==0) ljvvk.hasPagesIndex=true;
if(wopvT.typ==1) ljvvk.hasMarketItemIndex=true;
if(wopvT.typ==2) ljvvk.hasImagesIndex=true;

if(MrAfl)
{
var OKIgL=UpfdB[QgEYD];
if(OKIgL==undefined)
{
UpfdB[QgEYD]=new Object();
OKIgL=UpfdB[QgEYD];
OKIgL.scoring=0;
OKIgL.objResult=wopvT;
}
OKIgL.scoring+=ZDJdN;
}
}
}
}
if(OIbFP)
{
var QUwqv=new Array();
for(var index in UpfdB)
{
for(var index2 in OIbFP)
{
if(index2==index)
{
QUwqv[index]=UpfdB[index];
break;
}
}
}
UpfdB=QUwqv;
}
OIbFP=UpfdB;
}
}
var mQQKg=new Array();
var EfMKw=0;
for(var rriNJ in UpfdB)
{
var OKIgL=UpfdB[rriNJ] 
var ClNQP=new Array();
ClNQP.OKIgL=OKIgL;
ClNQP.index_page=rriNJ;
ClNQP.scoring=0;

ClNQP.test_index=EfMKw;
mQQKg.push(ClNQP);
EfMKw++;
}
mQQKg=mQQKg.sort(sueQt);
return mQQKg;
}
function veVai()
{
}

function wdkxi(a,b)
{
if(a.length<b.length) return-1;
else
if(a.length>b.length) return 1;
return 0;
}
function sueQt(a,b)
{
var udtHg=a.OKIgL
var eCqfb=b.OKIgL
if(eCqfb.scoring<udtHg.scoring) return-1;
else
if(eCqfb.scoring>udtHg.scoring) return 1;
if(udtHg.typ<eCqfb.typ) return-1;
else
if(udtHg.typ>eCqfb.typ) return 1;
return 0;
}

-->
