vjo.ctype("vjo.darwin.domain.finding.findstore.FindStore").needs(["vjo.dsf.Element","vjo.dsf.EventDispatcher","vjo.dsf.window.utils.VjWindowUtils","vjo.dsf.client.Browser"]).protos({constructs:function(_1){this.model=_1;this.firstCall=true;this.vED=vjo.dsf.EventDispatcher;this.vWu=vjo.dsf.window.utils.VjWindowUtils;this.E=vjo.dsf.Element;this.vED.addEventListener(window,"load",this.init,this)},init:function(){this.trigger=this.E.get(this.model.catsTrigId);this.nameRadio=this.E.get(this.model.nameRadioId);
this.itemRadio=this.E.get(this.model.itemRadioId);this.form=this.E.get(this.model.formId);var _2=this;if(this.model.catsList&&this.model.catsList.length>0){this.vED.addEventListener(this.trigger,"mouseover",this.showCatsMenu,this);this.vED.addEventListener(this.trigger,"mouseout",this.hideCatsMenu,this)}this.vED.addEventListener(this.form,"submit",this.onSubmit,this)},onSubmit:function(_3){if(this.nameRadio.checked)this.form.action=this.model.nameSearchBaseUrl;else this.form.action=this.model.itemSearchBaseUrl;
this.form.submit()},showCatsMenu:function(){if(this.firstCall){this.buildCats(this.model.catsList);document.body.appendChild(this.menuDiv);this.f1.style.width=this.menuWrapper.offsetWidth-2+"px";this.firstCall=false}else this.menuDiv.style.display="block";this.calPosition();for(var i=0;i<3;i++)this.ulList[i].style.width=this.ulList[i].offsetWidth+"px"},hideCatsMenu:function(){this.menuDiv.style.display="none"},calPosition:function(){var _5=vjo.dsf.client.Browser.bFirefox?20:-15;var _6=vjo.dsf.client.Browser.bFirefox?
0:-3;this.menuDiv.style.top=this.vWu.offsetTop(this.trigger)+_5+"px";this.menuDiv.style.left=this.vWu.offsetLeft(this.trigger)+_6+"px"},buildCats:function(_7){var _8=_7.length;var _9=Math.ceil(_8/3);this.ulList=[];var i=0;var _b;this.menuDiv=document.createElement("div");this.menuDiv.className="catsMu";this.menuWrapper=document.createElement("div");for(var _c=1;_c<=3;_c++){if(_c==3)_b=_7.slice(i,_8);else _b=_7.slice(i,_9*_c);i=_9*_c;var ul=this.buildUl(_b);this.menuWrapper.appendChild(ul);this.ulList.push(ul)}var _e=
document.createElement("div");_e.style.clear="both";this.menuWrapper.appendChild(_e);this.menuWrapper.className="catsMuDiv";this.menuDiv.appendChild(this.menuWrapper);this.vED.addEventListener(this.menuDiv,"mouseover",this.showCatsMenu,this);this.vED.addEventListener(this.menuDiv,"mouseout",this.hideCatsMenu,this);this.menuDiv.appendChild(this.buildFooter());return this.menuDiv},buildUl:function(_f){var ul=document.createElement("ul");var _11=_f.length;for(var j=0;j<_11;j++){var li=document.createElement("li");
var a=document.createElement("a");a.href=_f[j].url;a.appendChild(document.createTextNode(_f[j].title));li.appendChild(a);ul.appendChild(li)}return ul},buildFooter:function(){this.f1=document.createElement("div");var f2=document.createElement("div");var f3=document.createElement("div");this.f1.className="f1";f2.className="f2";f3.className="f3";f2.appendChild(f3);this.f1.appendChild(f2);return this.f1}}).endType();
vjo.ctype("vjo.darwin.core.searchbox.EbaySearchBox").needs("vjo.dsf.Element").protos({textBoxId:null,buttonId:null,buttonInitiallyDisabled:false,constructs:function(_1,_2,_3){this.textBoxId=_1;this.buttonId=_2;this.buttonInitiallyDisabled=_3;if(this.buttonInitiallyDisabled)this.updateButton();return this},clearTextBox:function(){var _4=vjo.dsf.Element.get(this.textBoxId);var _5=vjo.dsf.Element.get(this.buttonId);if(_4.defaultValue==_4.value)_4.value=""},updateButton:function(){var _6=vjo.dsf.Element.get(this.buttonId);
var _7=vjo.dsf.Element.get(this.textBoxId);if(_6!==null&&_7!==null)if(this.buttonInitiallyDisabled&&_7.defaultValue==_7.value)_6.disabled=true;else _6.disabled=_7.value.replace(/\s/g,"").length<1}}).endType();
vjo.ctype("vjo.dsf.utils.Timer").protos({timer:null,isRunning:false,interval:null,onTick:function(){},onStart:null,onStop:null,constructs:function(_1){this.interval=_1},setInterval:function(ms){var t=this;if(t.isRunning)window.clearInterval(t.timer);t.interval=ms;if(t.isRunning)t.setInt()},start:function(){var t=this;if(typeof t.onStart=="function")t.onStart();t.isRunning=true;t.setInt()},stop:function(){var t=this;if(typeof t.onStop=="function")t.onStop();t.isRunning=false;window.clearInterval(t.timer)},
setInt:function(){var t=this;t.timer=window.setInterval(vjo.hitch(t,t.onTick),t.interval)}}).endType();
vjo.ctype("vjo.darwin.domain.finding.autofill.AutoFillEncoder").protos({aCharList:[[new RegExp("[%]","g"),"_"],[new RegExp("[.]","g"),"_2e"],[new RegExp("[+]","g"),"_2b"],[new RegExp("[']","g"),"_27"]],pseudoDiv:null,constructs:function(){this.pseudoDiv=document.createElement("div")},encode:function(_1){var _2=encodeURIComponent(_1);var t=this;for(var j=0;j<t.aCharList.length;j++){var _4=t.aCharList[j];_2=_2.replace(_4[0],_4[1])}return _2},decodeCookie:function(_5){var _6=_5||"";_6=_6.replace(new RegExp("[+]",
"g")," ");_6=decodeURIComponent(_6);return _6},encodeHTML:function(_7){var e=this.pseudoDiv;if(typeof e.textContent!="undefined")e.textContent=_7;else e.innerText=_7;return e.innerHTML}}).endType();
vjo.ctype("vjo.darwin.domain.finding.autofill.AutoFillCache").needs("vjo.darwin.domain.finding.autofill.AutoFillEncoder").protos({oCache:{},oIndex:{},oReference:{},oLeaf:{},oEncoder:null,UN:"undefined",TNU:"number",constructs:function(){this.oEncoder=new vjo.darwin.domain.finding.autofill.AutoFillEncoder},add:function(_1){try{var t=this;var kw=_1[0];var kwList=_1[1];var laList=_1[2];var cacheItem=t.oCache[kw];if(_1.length>=3)t.addItem(kw,kw,"k",kwList);else try{if(typeof kwList[0]=="string"){laList=
null;t.addItem(kw,kw,"k",kwList)}else if(typeof kwList[0]=="object"&&kwList[0]instanceof Array)laList=_1[1]}catch(err){laList=null}if(laList!==null)for(var i=0;i<laList.length;i++){var _4=laList[i];var lookAheadKw=kw+_4[0];var lookAheadType=_4[1];var lookAheadList=_4[2];if(typeof lookAheadList==t.UN||lookAheadList===null){lookAheadType="fd";lookAheadList=_4[0]}t.addItem(lookAheadKw,kw,lookAheadType,lookAheadList)}else t.addItem(kw,kw,"null")}catch(e){}},addItem:function(_5,_6,_7,_8){var t=this;_5=
_5.toLowerCase();_6=_6.toLowerCase();if(_7=="k"){t.oCache[_5]=t.buildItem("k",typeof _8==t.TNU?""+_8:_8,_6);return t.oCache[_5]}else if(_7=="f"){t.oIndex[_5]=t.buildItem("f",typeof _8==t.TNU?""+_8:_8,_6);return t.oIndex[_5]}else if(_7=="fd"){t.oReference[_5]=t.buildItem("fd",_8,_6);return t.oReference[_5]}else if(_7=="null"){t.oLeaf[_5]=t.buildItem("null",null,_6);return t.oLeaf[_5]}},buildItem:function(_a,_b,_c){var _d={type:_a,shortPrefix:_c};if(_b!==null)_d.keyword=_b;return _d},get:function(_e,
_f){_e=_e.toLowerCase();_f=_f.toLowerCase();var t=this;var cacheItem=t.oCache[_e];var indexItem=t.oIndex[_e];var referenceItem=t.oReference[_e];if(typeof cacheItem!=t.UN&&typeof cacheItem!=t.TFU)return cacheItem;if(typeof indexItem!=t.UN&&typeof indexItem!=t.TFU)return indexItem;if(typeof referenceItem!=t.UN&&typeof referenceItem!=t.TFU)return referenceItem;if(_f){var _11=t.oLeaf[_f];if(typeof _11!=t.UN&&typeof _11!=t.TFU)return _11;var _12=[];for(var _13 in t.oIndex){var _14=t.oIndex[_13];if(_14.shortPrefix==
_f)_12.push(_13)}_12.sort();if(_12.length===0)return null;var _15=_12.length-1;for(i=0;i<_12.length;i++)if(_e<_12[i]){_15=i-1;break}if(_15<0)_15=0;return t.oIndex[_12[_15]]}return null}}).endType();
vjo.ctype("vjo.darwin.domain.finding.autofill.AutoFillRequest").needs("vjo.dsf.XDomainRequest").needs("vjo.Registry").needs("vjo.dsf.utils.Object").needs("vjo.dsf.utils.Handlers").needs("vjo.dsf.utils.Timer").needs("vjo.dsf.Element").needs("vjo.darwin.domain.finding.autofill.AutoFillCache").needs("vjo.darwin.domain.finding.autofill.AutoFillEncoder").singleton().protos({aReqList:[],oCache:null,oConfig:{baseURL:null,dirDepth:null,rootDir:null,algorithm:null,version:null,siteId:null},oEncoder:null,sRespSvc:"autofill_response",
iTimeout:1E3,iProcessInterval:20,oProcessTimer:null,inProcess:false,bInit:false,vX:vjo.dsf.XDomainRequest,uN:"undefined",constructs:function(){},init:function(_1){var t=this;if(t.bInit)return;var tO=t.oConfig;tO.baseURL=_1.baseURL;tO.dirDepth=_1.dirDepth;tO.rootDir=_1.rootDir;tO.algorithm=_1.algorithm;tO.version=_1.version;tO.siteId=_1.siteId;t.oCache=new vjo.darwin.domain.finding.autofill.AutoFillCache;t.oEncoder=new vjo.darwin.domain.finding.autofill.AutoFillEncoder;t.oProcessTimer=new vjo.dsf.utils.Timer;
t.oProcessTimer.setInterval(t.iProcessInterval);t.oProcessTimer.onTick=function(){if(t.inProcess)return;t.inProcess=true;try{t.processQue();t.cleanQue()}catch(e){}t.inProcess=false};t.oProcessTimer.start();t.bInit=true},processQue:function(){var t=this;var queLength=t.aReqList.length;if(queLength===0)return;var _5=t.aReqList[0];if(_5&&_5.state=="wait"){t.aReqList[0].state="process";var _6=t.vX.bUseIframe;try{t.vX.bUseIframe=false;var _7=t.vX.send(_5.url,false);t.aReqList[0].scriptId=_7}catch(e){}t.vX.bUseIframe=
_6}},cleanQue:function(){var t=this;var newList=[];var i;for(i=0;i<t.aReqList.length;i++){var _9=t.aReqList[i];if(_9.state=="wait")newList.push(_9);else if(_9.state=="process"){var _a=new Date;var time=_a.getTime()-_9.timestamp;if(time>=t.iTimeout){t.removeScriptTag(_9.scriptId);t.sendRespService(true,_9.requester,_9.prefix,null,null,_9.shortPrefix)}else newList.push(_9)}}t.aReqList=newList},removeScriptTag:function(_b){var t=this;if(_b&&_b.length>0){var _d=vjo.dsf.Element.get(_b);var scriptLoc=t.vX.getReqDiv();
if(scriptLoc&&_d)scriptLoc.removeChild(_d)}},getRespSvc:function(){return this.sRespSvc},getShortPrefix:function(_e){var t=this;var dirDepth=t.oConfig.dirDepth;var shortPrefix=_e.substr(0,dirDepth+1);return shortPrefix},buildPath:function(pKw,_11){var t=this;var pd=_11?1E4:t.oConfig.dirDepth;var pathStr=pKw.length>pd?pKw.substr(0,pd):pKw.substr(0,pKw.length-1);var fileStr=pKw.length>pd?pKw.substr(pd,1):pKw.substr(pKw.length-1,1);var encodedPathStr="";var _13=pathStr.toLowerCase();var lowFileStr=fileStr.toLowerCase();
for(var i=0;i<_13.length;i++)encodedPathStr+=t.encodeChar(_13.charAt(i))+"/";return[encodedPathStr,t.encodeChar(lowFileStr),pathStr+fileStr]},encodeChar:function(_15){return this.oEncoder.encode(_15)},buildURL:function(){var t=this;var tO=t.oConfig;var url=tO.baseURL;if(typeof tO.version==t.uN||tO.version===null)return null;if(url.lastIndexOf("/")<url.length-1)url+="/";url+=tO.rootDir+"/";url+=tO.algorithm+"/";url+=tO.siteId+"/";url+=tO.version+"/";return url},addRequest:function(_17,_18,_19,_1a){var t=
this;var url=t.buildURL();var fileInfo=t.buildPath(_18,_19=="fd");if(url===null)return;if(url.lastIndexOf("/")<url.length-1)url+="/";url+=fileInfo[0]+fileInfo[1];if(_19=="f"&&typeof _1a!=t.uN&&_1a.length>0)url+=_1a;url+=".js";var _1c=new Date;t.aReqList.push({requester:_17,prefix:_18,shortPrefix:t.getShortPrefix(_18),url:url,state:"wait",timestamp:_1c.getTime(),type:_19})},send:function(_1d,_1e){var t=this;if(!t.bInit)return;var _20=t.getShortPrefix(_1e);var cacheResp=t.oCache.get(_1e,_20);if(cacheResp===
null)t.addRequest(_1d,_1e,"k");else if(cacheResp.type=="f"||cacheResp.type=="fd")t.addRequest(_1d,_1e,cacheResp.type,cacheResp.keyword);else if(cacheResp.type=="null")t.sendRespService(true,_1d,_1e,[],[],_20);else t.sendRespService(false,_1d,_1e,cacheResp.keyword,[],_20)},sendRespService:function(_21,_22,_23,_24,_25,_26){var H=vjo.dsf.utils.Handlers;var m=H.newMsg(this.sRespSvc);if(_21)m.clientContext={timeout:true,prefix:_23,shortPrefix:_26,requestId:_22};else m.clientContext={timeout:false,prefix:_23,
shortPrefix:_26,requestId:_22,kwList:_24,laList:_25};H.handle(m)},handleResponse:function(_28){var t=this;var kw=_28[0];var kwList=_28[1];var laList=_28[2];var i;if(!t.bInit)return;t.oCache.add(_28);var _2a=[];for(i=0;i<t.aReqList.length;i++){var _2b=t.aReqList[i];if(_2b.state!="process")continue;if(_2b.prefix.toLowerCase()==_2b.shortPrefix.toLowerCase()){if(_2b.prefix.toLowerCase()==kw.toLowerCase()){_2b.state="done";t.removeScriptTag(_2b.scriptId);t.sendRespService(false,_2b.requester,kw,kwList,
laList,_2b.shortPrefix)}}else if(_2b.shortPrefix.toLowerCase()==kw.toLowerCase()){var _2c=t.oCache.get(_2b.prefix,_2b.shortPrefix);_2b.state="done";t.removeScriptTag(_2b.scriptId);if(_2b.type=="f"&&_2c.type!="k")t.sendRespService(true,_2b.requester,_2b.prefix,null,null,_2b.shortPrefix);else _2a.push(_2b)}}for(i=0;i<_2a.length;i++){var _2d=_2a[i];t.send(_2d.requester,_2d.prefix)}}}).inits(function(){vjo.darwin.domain.finding.autofill.AutoFillRequest=new vjo.darwin.domain.finding.autofill.AutoFillRequest}).endType();
vjo.ctype("vjo.darwin.domain.finding.autofill.AutoFill").needs("vjo.dsf.ServiceEngine").needs("vjo.Registry").needs("vjo.dsf.Element").needs("vjo.dsf.Message").needs("vjo.dsf.document.Shim").needs("vjo.dsf.utils.Handlers").needs("vjo.dsf.cookie.VjCookieJar").needs("vjo.darwin.domain.finding.autofill.AutoFillRequest").needs("vjo.darwin.domain.finding.autofill.AutoFillEncoder").props({_do:function(_1){vjo.darwin.domain.finding.autofill.AutoFillRequest.handleResponse(_1)}}).protos({oConfig:null,oKeyTimer:null,
sCurKw:"",sLastKw:"",iCurSel:-1,aCurKwList:[],bInSugDiv:false,sInputId:null,oIframeShim:null,oRequest:vjo.darwin.domain.finding.autofill.AutoFillRequest,sRequestId:"autofill",bLastQueryEmpty:false,oEncoder:new vjo.darwin.domain.finding.autofill.AutoFillEncoder,VE:vjo.dsf.Element,VED:vjo.dsf.EventDispatcher,VS:vjo.dsf.ServiceEngine,constructs:function(_2,_3){var t=this;var vEvt=t.VED;var vS=t.VS;t.sRequestId=_3;t.oConfig=_2;vS.registerSvcHdl(t.oRequest.getRespSvc(),vjo.hitch(t,t.handleResp));vEvt.add(_2.getContainerId(),
"mouseover",vjo.hitch(t,this.onMouseIn));vEvt.add(_2.getContainerId(),"mouseout",vjo.hitch(t,this.onMouseOut));vEvt.addEventListener(window,"resize",t.onWindowResize,t);var _5=_2.getIdList();var i;var id;_5=_2.getHideLnkList();for(i=0;i<_5.length;i++){id=_5[i];vEvt.add(id,"click",vjo.hitch(t,this.onHideClick))}vS.registerSvcHdl(_2.getOutSvc(),function(_6){var _7=_6.clientContext;t.setInputId(_7.srcId);switch(_7.type){case "kw_keyup":t.kw_keyup(_7);break;case "kw_blur":t.kw_blur(_7);break;case "kw_keydown":t.kw_keydown(_7);
break;case "kw_mouseover":t.kw_mouseover(_7);break;case "show_click":t.show_click(_7);break}});t.updTrk(_2.getTrkInput());t.setAutoComplete(t.isHideSuggestion())},handleResp:function(_8){var t=this;var config=t.oConfig;var context=_8.clientContext;var i;var kwList=context.kwList||[];var laList=context.laList||[];if(t.sRequestId!=context.requestId||context.prefix.toLowerCase()!=t.getInputValue().toLowerCase())return;var _a=t.getRecentSearch();if(_a&&_a.length>0){var _b=_a.toLowerCase();var index=_b.indexOf(t.sCurKw.toLowerCase());
var bRecentMatch=false;var sRecentPart=_b;for(var preIndex=0;index>=0;){if(t.isWordStart(_b,index+preIndex)){bRecentMatch=true;break}preIndex=index+1;sRecentPart=sRecentPart.substr(index+1);index=sRecentPart.indexOf(t.sCurKw.toLowerCase())}if(bRecentMatch){var _c=[];_c.push(_a);for(i=0;i<kwList.length;i++)if(kwList[i].toLowerCase()!=_b)_c.push(kwList[i]);if(_c.length>config.getListSize())_c.pop();kwList=_c}}if(context.timeout&&context.prefix==t.sCurKw&&kwList.length<1){if(!t.bLastQueryEmpty){t.showNoSugMessage(true);
t.showSugDiv(true,config.getWidthMin().px)}else t.showSugDiv(false);t.bLastQueryEmpty=true;return}t.bLastQueryEmpty=false;t.showNoSugMessage(false);t.iCurSel=-1;t.aCurKwList=[];var _d=config.getIdList();var listLength=_d.length;if(listLength>config.getListSize())listLength=config.getListSize();if(t.sInputId!==null){var _e=t.VE.get(t.sInputId);if(_e)config.updateWidthDef(_e)}var _f=t.getMaxKwLength(kwList,listLength);var clipLength=config.getWidthMax()["char"];var dispPx=_f*config.getWidthUnit();if(dispPx<
config.getWidthMin().px)dispPx=config.getWidthMin().px;else if(dispPx>config.getWidthMax().px)dispPx=config.getWidthMax().px;for(i=0;i<listLength;i++){var en=_d[i];var e=t.VE.get(en);if(e===null)continue;e.className="unsel";if(i<kwList.length){e.innerHTML=t.genKwHTML(kwList[i],t.sCurKw,clipLength);t.VE.toggleHideShow(en,true);var trk=kwList[i]==_a?config.getTrkRS():config.getTrkSuggest();t.aCurKwList[i]={divId:en,sugKw:kwList[i],trk:trk}}else t.VE.toggleHideShow(en,false)}t.showSugDiv(true,dispPx)},
getInputValue:function(){var t=this;var e=t.VE.get(t.sInputId);return e?e.value:""},isHideSuggestion:function(){var vC=vjo.dsf.cookie.VjCookieJar;var pbf=vC.readCookie("dp1","pbf");var bit=vC.getBitFlag(pbf,29);return bit==1},setHideSuggestion:function(_14){var vC=vjo.dsf.cookie.VjCookieJar;var pbf=vC.readCookie("dp1","pbf");vC.writeCookielet("dp1","pbf",vC.setBitFlag(pbf,29,_14?1:0))},getRecentSearch:function(){var lss=this.oConfig.getLastSearch();if(lss!==null&&lss.length>0){lss=lss.substring(lss.indexOf(".")+
1);return lss}return""},getMaxKwLength:function(_17,_18){if(!_17)return 0;var max=0;var length=_17.length;if(length>_18)length=_18;for(var i=0;i<_17.length;i++){var len=_17[i].length;if(len>max)max=len}return max},isWordStart:function(pKw,_1d){if(_1d<=0||_1d>pKw.length-1)return true;var _1e=pKw.substr(_1d-1,1);var wordDelimiter=new RegExp("[\\s \\.,]");return _1e.search(wordDelimiter)>=0},genKwHTML:function(pKw,_20,_21){var _22=_20.length;var out=pKw;var t=this;var encoder=t.oEncoder;var part;var startIndex=
-1;for(var i=0;i<pKw.length;i++){part=pKw.substr(i,_22);if(part.length!=_22)break;if(part.toLowerCase()==_20.toLowerCase()&&t.isWordStart(pKw,i)){startIndex=i;break}}var _24=pKw.substring(0,startIndex);var afterPart=pKw.substr(startIndex+_22);var keepLength;if(startIndex>=0)if(pKw.length>_21)if(_24.length>_21){out=encoder.encodeHTML(out.substr(0,_21));out+="..."}else if(_24.length+part.length>_21){keepLength=_21-_24.length;part="<span class='hl'>"+encoder.encodeHTML(part.substr(0,keepLength))+"...</span>";
out=encoder.encodeHTML(_24)+part}else{keepLength=_21-_24.length-part.length;out=encoder.encodeHTML(_24)+"<span class='hl'>"+encoder.encodeHTML(part)+"</span>"+encoder.encodeHTML(afterPart.substr(0,keepLength))+"..."}else out=encoder.encodeHTML(_24)+"<span class='hl'>"+encoder.encodeHTML(part)+"</span>"+encoder.encodeHTML(afterPart);else if(pKw.length>_21){out=encoder.encodeHTML(out.substr(0,_21));out+="..."}return out},startKeyTimer:function(_25){var t=this;t.stopKeyTimer();var _27=function(){var _28=
t.getInputValue();if(_25!=_28||_28.length<1)return;t.oRequest.send(t.sRequestId,_25)};t.oKeyTimer=window.setTimeout(_27,t.oConfig.getDelayTime())},stopKeyTimer:function(){var t=this;if(t.oKeyTimer!==null){window.clearTimeout(t.oKeyTimer);t.oKeyTimer=null}},getKwSelect:function(){var t=this;if(t.iCurSel<0)return t.sCurKw;return t.aCurKwList[t.iCurSel].sugKw},selectSug:function(_2b,_2c,_2d){var t=this;var kw=t.sCurKw;if(t.iCurSel>=0)t.unselectSug(t.aCurKwList[t.iCurSel].divId);if(_2b!==null){var e=
t.VE.get(_2b);for(var i=0;i<t.aCurKwList.length;i++){var _31=t.aCurKwList[i];if(_31.divId==_2b){t.iCurSel=i;kw=_31.sugKw;break}}if(e)e.className="sel"}else t.iCurSel=-1;if(!_2d)t.updateInput(kw);if(!_2c)t.focusInput()},unselectSug:function(_32){var t=this;var e=t.VE.get(_32);if(e)e.className="unsel"},createTrackingImg:function(_34){var _35=new Date;var r=_35.getTime();var imgUrl=_34;if(imgUrl.indexOf("?")>0)imgUrl+="&"+r;else imgUrl+="?"+r;var img=new Image;var bodyLoc=document.getElementsByTagName("body")[0];
bodyLoc.appendChild(img);img.setAttribute("src",imgUrl);img.setAttribute("width","1");img.setAttribute("height","1");img.setAttribute("border","0")},sendInSvc:function(_37){var H=vjo.dsf.utils.Handlers;var m=H.newMsg(this.oConfig.getInSvc());m.clientContext=_37;H.handle(m)},isCtrlKey:function(_39){var _3a=[38,39,40,27];for(var i=0;i<_3a.length;i++)if(_3a[i]==_39)return true;return false},isIgnorKey:function(_3c){var _3d=[16,17,18];for(var i=0;i<_3d.length;i++)if(_3c==_3d[i])return true;return false},
isSugShown:function(){var t=this;var sugDiv=t.VE.get(this.oConfig.getContainerId());disp=sugDiv.currentStyle?sugDiv.currentStyle.display:window.getComputedStyle(sugDiv,null).getPropertyValue("display");return disp!="none"},isNoSugMsgShow:function(){var t=this;var noSuggestionMessage=t.VE.get(this.oConfig.getNoSugDivId());disp=noSuggestionMessage.currentStyle?noSuggestionMessage.currentStyle.display:window.getComputedStyle(noSuggestionMessage,null).getPropertyValue("display");return disp!="none"},
showNoSugMessage:function(_41){var t=this;t.VE.toggleHideShow(t.oConfig.getSugDivId(),!_41);t.VE.toggleHideShow(t.oConfig.getNoSugDivId(),_41);if(_41){var _43=function(){if(t.isNoSugMsgShow())t.showSugDiv(false)};window.setTimeout(_43,t.oConfig.getNoSugShowTime())}},showSugDiv:function(_44,_45){var t=this;if(t.isHideSuggestion()&&_44){t.showIcon(true);return}var vS=vjo.dsf.document.Shim;var containerId=t.oConfig.getContainerId();var oDiv=t.VE.get(containerId);if(_44){t.posLayer(_45);t.VE.toggleHideShow(containerId,
true);if(t.oIframeShim)vS.remove(oDiv,t.oIframeShim);t.oIframeShim=vS.add(oDiv);var _48=function(){t.regOverEvent(true)};window.setTimeout(_48,100)}else{t.VE.toggleHideShow(containerId,false);if(t.oIframeShim!==null){vS.remove(oDiv,t.oIframeShim);t.oIframeShim=null}t.regOverEvent(false)}},regOverEvent:function(_49){var t=this;var idList=t.oConfig.getIdList();var i;var id;for(i=0;i<idList.length;i++){id=idList[i];t.VED.unregister(id,"mouseover");t.VED.unregister(id,"click")}if(_49)for(i=0;i<idList.length;i++){id=
idList[i];t.VED.add(id,"mouseover",vjo.hitch(t,this.onListMouseOver));t.VED.add(id,"click",vjo.hitch(t,this.onListClick))}},posLayer:function(_4b){var t=this;var inputPos=t.getAbsPos(t.sInputId);if(inputPos===null)return false;var e=t.VE.get(t.oConfig.getContainerId());if(e===null)return false;e.style.left=inputPos.left+"px";e.style.top=inputPos.top+inputPos.height+"px";if(typeof _4b!="undefined"&&_4b!==null)e.style.width=parseInt(_4b,10)+"px";return true},getAbsPos:function(_4e,_4f){var t=this;var obj=
_4e;if(!_4e)return null;if(typeof _4e=="string"){obj=t.VE.get(_4e);if(obj===null)return null}var top=obj.offsetTop;var left=obj.offsetLeft;var height=obj.offsetHeight;var width=obj.offsetWidth;var pos="";var of="";for(obj=obj.offsetParent;obj!==null;){if(_4f){pos=obj.currentStyle?obj.currentStyle.position:window.getComputedStyle(obj,null).getPropertyValue("position");of=obj.currentStyle?obj.currentStyle.overflow:window.getComputedStyle(obj,null).getPropertyValue("overflow");if(pos=="absolute"||pos==
"relative"||of!=="visible"&&of!=="")break}top+=obj.offsetTop;left+=obj.offsetLeft;obj=obj.offsetParent}return{left:parseInt(left,10),top:parseInt(top,10),height:parseInt(height,10),width:parseInt(width,10)}},updateInput:function(pKw){var t=this;if(t.isSugShown()){t.sLastKw=pKw;var _55={type:"kw_updvalue",value:pKw};t.sendInSvc(_55)}},updTrk:function(_56){var _57={type:"search_updtrk",lnkStr:_56};this.sendInSvc(_57)},submitForm:function(){var t=this;if(t.iCurSel>=0){var trk=t.aCurKwList[t.iCurSel].trk;
t.updTrk(trk)}var _5a={type:"search_submit"};this.sendInSvc(_5a)},showIcon:function(_5b){var _5c={type:"sug_icon_show",bShow:_5b};this.sendInSvc(_5c)},focusInput:function(){var _5d={type:"kw_focus"};this.sendInSvc(_5d)},setAutoComplete:function(bOn){var _5f={type:"kw_autocomplete",bOn:bOn};this.sendInSvc(_5f)},setInputId:function(pId){var t=this;if(t.sInputId===null)t.sInputId=pId;var e=t.VE.get(pId);if(e)t.oConfig.updateWidthDef(e)},show_click:function(_63){var t=this;t.showIcon(false);t.setHideSuggestion(false);
t.bLastQueryEmpty=false;t.oRequest.send(t.sRequestId,t.getInputValue());var _65=function(){t.createTrackingImg(t.oConfig.getTrkShow())};window.setTimeout(_65,500);t.setAutoComplete(false)},kw_blur:function(_66){var t=this;if(t.isSugShown()&&!t.isNoSugMsgShow())if(!t.bInSugDiv){t.selectSug(null,true);t.showSugDiv(false)}else t.focusInput()},kw_mouseover:function(_68){var t=this;if(t.isSugShown()&&!t.isNoSugMsgShow())t.selectSug(null)},kw_keydown:function(_6a){var t=this;var kc=_6a.keyCode;if(kc==13&&
t.isSugShown()&&!t.isNoSugMsgShow()){if(t.iCurSel>=0){var trk=t.aCurKwList[t.iCurSel].trk;t.updTrk(trk)}t.showSugDiv(false)}},kw_keyup:function(_6d){var t=this;var kc=_6d.keyCode;var cv=_6d.value;if(t.isIgnorKey(kc))return;if(t.isSugShown()&&!t.isNoSugMsgShow())if(t.isCtrlKey(kc)){var e;var _70;var _71;switch(kc){case 38:_70=t.iCurSel-1;if(_70<-1)_70=t.aCurKwList.length-1;_71=_70>=0?t.aCurKwList[_70].divId:null;t.selectSug(_71);t.iCurSel=_70;break;case 40:_70=t.iCurSel+1;if(_70>=t.aCurKwList.length)_70=
-1;_71=_70>=0?t.aCurKwList[_70].divId:null;t.selectSug(_71);break;case 39:if(cv.length!==0){t.sCurKw=cv;t.startKeyTimer(cv);t.sLastKw=cv}break;case 27:t.selectSug(null);t.showSugDiv(false);break}}else if(cv.length!==0){if(t.sLastKw!=cv){t.sCurKw=cv;t.startKeyTimer(cv);t.sLastKw=cv}}else{t.showSugDiv(false);t.showIcon(false);t.sCurKw=cv;t.sLastKw=cv;t.bLastQueryEmpty=false}else if(cv.length!==0){if(t.sLastKw!=cv){t.sCurKw=cv;t.startKeyTimer(cv);t.sLastKw=cv}}else{t.sCurKw=cv;if(t.isHideSuggestion())t.showIcon(false);
t.sLastKw=cv;t.bLastQueryEmpty=false}},onListMouseOver:function(_72){this.bInSugDiv=true;var e=_72.src;this.selectSug(e.id,false,true)},onListClick:function(_74){var e=_74.src;var t=this;t.selectSug(e.id);t.submitForm();t.showSugDiv(false)},onMouseIn:function(_76){this.bInSugDiv=true},onMouseOut:function(_77){this.bInSugDiv=false},onHideClick:function(_78){var t=this;t.setHideSuggestion(true);t.selectSug(null);t.showSugDiv(false);t.setAutoComplete(true);t.showIcon(true);var _7a=function(){t.createTrackingImg(t.oConfig.getTrkHide())};
window.setTimeout(_7a,500);return false},onWindowResize:function(_7b){if(this.isSugShown())this.showSugDiv(true)}}).endType();
vjo.ctype("vjo.darwin.domain.finding.autofill.AutoFillConfig").needs("vjo.darwin.domain.finding.autofill.AutoFillEncoder").protos({oModel:{rootDir:"autofill",listSize:7,delayTime:200,dirDepth:3,noSugShowTime:1500,svcIn:"SVC_GH_IN",svcOut:"SVC_GH_OUT"},defaultAlgo:"1",algoMap:{"1":"f","2":"a"},widthDef:{unit:9,min:{px:233,"char":26},max:{px:400,"char":40}},oEncoder:null,constructs:function(_1){this.oEncoder=new vjo.darwin.domain.finding.autofill.AutoFillEncoder;this.loadConfig(_1)},loadConfig:function(_2){var t=
this;var tM=t.oModel;if(_2.version===null||_2.algorithm===null){tM.version=_2.algoVerMap[t.defaultAlgo];tM.algorithm=t.algoMap[t.defaultAlgo]}else{tM.version=_2.version;tM.algorithm=t.algoMap[_2.algorithm]}tM.trkSuggest=_2.trkSuggest;tM.trkRS=_2.trkRS;tM.trkInput=_2.trkInput;tM.trkShow=_2.trkShow;tM.trkHide=_2.trkHide;tM.containerId=_2.containerId;tM.idList=_2.idList;tM.sugDivId=_2.sugDivId;tM.noSugDivId=_2.noSugDivId;tM.hideLnkList=_2.hideLnkList;tM.baseURL=_2.baseURL;tM.siteId=_2.siteId;tM.lastSearch=
t.oEncoder.decodeCookie(_2.lastSearch);tM.svcIn=_2.svcIn;tM.svcOut=_2.svcOut},updateWidthDef:function(_4){var t=this;var inputWidth=parseInt(_4.offsetWidth,10);t.widthDef.max={px:inputWidth,"char":Math.floor(inputWidth/t.widthDef.unit)-1}},getHideLnkList:function(){return this.oModel.hideLnkList},getWidthUnit:function(){return this.widthDef.unit},getWidthMin:function(){return this.widthDef.min},getWidthMax:function(){return this.widthDef.max},getRootDir:function(){return this.oModel.rootDir},getListSize:function(){return this.oModel.listSize},
getDelayTime:function(){return this.oModel.delayTime},getDirDepth:function(){return this.oModel.dirDepth},getAlgorithm:function(){return this.oModel.algorithm},getVersion:function(){return this.oModel.version},getTrkSuggest:function(){return this.oModel.trkSuggest},getTrkRS:function(){return this.oModel.trkRS},getTrkInput:function(){return this.oModel.trkInput},getTrkShow:function(){return this.oModel.trkShow},getTrkHide:function(){return this.oModel.trkHide},getContainerId:function(){return this.oModel.containerId},
getIdList:function(){return this.oModel.idList},getKeyUpSvc:function(){return this.oModel.keyUpSvc},getKeyDownSvc:function(){return this.oModel.keyDownSvc},getInputOverSvc:function(){return this.oModel.inputOverSvc},getUpdInputSvc:function(){return this.oModel.updInputSvc},getFillContentSvc:function(){return this.oModel.fillContentSvc},getInSvc:function(){return this.oModel.svcIn},getOutSvc:function(){return this.oModel.svcOut},getBaseURL:function(){return this.oModel.baseURL},getSiteId:function(){return this.oModel.siteId},
getSugDivId:function(){return this.oModel.sugDivId},getNoSugDivId:function(){return this.oModel.noSugDivId},getNoSugShowTime:function(){return this.oModel.noSugShowTime},getLastSearch:function(){return this.oModel.lastSearch}}).endType();
vjo.ctype("vjo.darwin.domain.finding.autofill.AutoFillInit").needs("vjo.dsf.EventDispatcher").needs("vjo.dsf.ServiceEngine").needs("vjo.darwin.domain.finding.autofill.AutoFillConfig").needs("vjo.darwin.domain.finding.autofill.AutoFill").needs("vjo.darwin.domain.finding.autofill.AutoFillRequest").protos({constructs:function(_1){this.oModel=_1;var t=this;var _3=function(){var _4=new vjo.darwin.domain.finding.autofill.AutoFillConfig(t.oModel);var requestConfig={baseURL:_4.getBaseURL(),dirDepth:_4.getDirDepth(),
rootDir:_4.getRootDir(),algorithm:_4.getAlgorithm(),version:_4.getVersion(),siteId:_4.getSiteId()};vjo.darwin.domain.finding.autofill.AutoFillRequest.init(requestConfig);new vjo.darwin.domain.finding.autofill.AutoFill(_4,t.oModel.requestId)};vjo.dsf.EventDispatcher.add("body","load",_3)}}).endType();
vjo.ctype("vjo.darwin.domain.finding.store.storesearchbox.StoreSearchBox").needs("vjo.dsf.Element").protos({constructs:function(_1,_2,_3){t=this;t.E=vjo.dsf.Element;t.tb=t.E.get(_1);t.button=t.E.get(_2);t.dd=t.E.get(_3);t.dd.selectedIndex=0;vjo.dsf.EventDispatcher.addEventListener(t.button,"click",t.submitForm,this);return this},submitForm:function(){var v=parseInt(t.dd[t.dd.selectedIndex].value);if(t.tb.defaultValue===t.tb.value||t.tb.value===""&&v<0){t.tb.value="";t.tb.focus();if(v==-6||v==-9)return false}}}).endType();
vjo.ctype("vjo.darwin.core.ebayheader.autocomplete.AutoComplete").needs(["vjo.dsf.Message","vjo.dsf.Element","vjo.dsf.EventDispatcher","vjo.dsf.utils.Handlers","vjo.dsf.ServiceEngine","vjo.dsf.window.utils.VjWindowUtils","vjo.darwin.core.ebayheader.autocomplete.AutoCompleteLazyInit"]).protos({H:vjo.dsf.utils.Handlers,constructs:function(_1,_2){var t=this;var E=vjo.dsf.Element;var ED=vjo.dsf.EventDispatcher;t.sFormId=_2;t.sAcDivId=_1+"_acdiv";t.acdivWidth=0;t.sShowImg=false;t.activated=true;t.sReskin=
true;t.H.attachSvcReqt("activateAutoComplete",t.activateAutoComplete,t);t.input=E.get(_1);t.input.setAttribute("AUTOCOMPLETE","OFF");if(t.input.className.has("xpborder"))t.sReskin=false;t.acdiv=E.get(t.sAcDivId);var _4=document.forms;ED.add(_1,"keyup",function(e){if(!t.activated)return;var _6=e.nativeEvent.keyCode;var _7=new vjo.dsf.Message("SVC_GH_OUT");_7.clientContext={type:"kw_keyup",src:e.src,value:t.input.value,keyCode:_6};return _7});ED.add(_1,"keydown",function(e){if(!t.activated)return;var _9=
e.nativeEvent.keyCode;var _a=new vjo.dsf.Message("SVC_GH_OUT");_a.clientContext={type:"kw_keydown",src:e.src,value:t.input.value,keyCode:_9};return _a});ED.add(_1,"mouseover",function(e){if(!t.activated)return;var _c=e.nativeEvent.keyCode;var _d=new vjo.dsf.Message("SVC_GH_OUT");_d.clientContext={type:"kw_mouseover",src:e.src};return _d});ED.add(_1,"blur",function(e){if(!t.activated)return;var _f=e.nativeEvent.keyCode;var _10=new vjo.dsf.Message("SVC_GH_OUT");_10.clientContext={type:"kw_blur",src:e.src};
return _10});ED.add(this.sAcDivId,"click",function(e){if(!t.activated)return;var _12=new vjo.dsf.Message("SVC_GH_OUT");_12.clientContext={type:"show_click"};return _12});vjo.dsf.ServiceEngine.registerSvcHdl("SVC_GH_IN",function(_13){if(!t.activated)return;var _14=_13.clientContext.type;if(_14=="kw_updvalue")t.input.value=_13.clientContext.value;else if(_14=="kw_autocomplete"){if(_13.clientContext.bOn&&!_13.clientContext.bSkipFocus)t.input.blur();t.input.setAttribute("AUTOCOMPLETE",_13.clientContext.bOn?
"ON":"OFF");if(_13.clientContext.bOn&&!_13.clientContext.bSkipFocus){t.input.blur();t.input.focus()}}else if(_14=="search_updtrk")for(i=0;i<_4.length;i++){if(_4[i].name==_2)for(var j=0;j<_4[i].length;j++)if(_4[i].elements[j].name=="_trksid"){var _16=_4[i].elements[j].value;var _17="";var _18=["p","m","l"];for(var _19 in _18){var _1a=new RegExp(_18[_19]+"[0-9]+(?=.|$)");var _1b=_16.match(_1a);var _1c=_13.clientContext.lnkStr.match(_1a);var _1d=_1c?_1c[0]:_1b?_1b[0]:null;var _1e=_17.length>0?".":"";
if(_1d)_17+=_1e+_1d}_4[i].elements[j].value=_17;return}}else if(_14=="search_submit")for(i=0;i<_4.length;i++){if(_4[i].name==_2){_4[i].submit();return}}else if(_14=="sug_icon_show")if(_13.clientContext.bShow)t.showImage();else t.hideImage();else if(_14=="kw_focus"){t.input.focus();t.input.value=t.input.value+""}})},activateAutoComplete:function(msg){var t=this;if(msg.activated)t.activated=true;else{t.hideImage();t.activated=false}},showImage:function(){var t=this;if(t.sShowImg)return;if(t.acdivWidth===
0){t.acdiv.style.display="inline";t.acdivWidth=t.acdiv.offsetWidth}var wd=t.sReskin?1:-3;var _23=t.acdivWidth-wd;if("BackCompat"==document.compatMode)if(t.sReskin)_23=_23-1;else _23=_23-5;t.input.style.width=t.input.clientWidth-_23+"px";t.input.style.borderRightWidth="0px";t.acdiv.style.display="inline";t.sShowImg=true},hideImage:function(){var t=this;if(!t.sShowImg)return;var wd=t.sReskin?1:5;var _26=t.acdiv.offsetWidth-wd;if("BackCompat"==document.compatMode)if(t.sReskin)_26=_26+2;else _26=_26+
6;t.input.style.width=t.input.clientWidth+_26+"px";t.input.style.borderRightWidth="1px";t.acdiv.style.display="none";t.sShowImg=false}}).props({init:function(_27,_28){new vjo.darwin.core.ebayheader.autocomplete.AutoComplete(_27,_28)}}).inits(function(){this.vj$.AutoCompleteLazyInit.callback()}).endType();
vjo.ctype("vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteEncoder").protos({aCharList:[[new RegExp("[%]","g"),"_"],[new RegExp("[.]","g"),"_2e"],[new RegExp("[+]","g"),"_2b"],[new RegExp("[']","g"),"_27"]],pseudoDiv:null,constructs:function(){this.pseudoDiv=document.createElement("div")},encode:function(_1){var _2=encodeURIComponent(_1);var t=this;for(var j=0;j<t.aCharList.length;j++){var _4=t.aCharList[j];_2=_2.replace(_4[0],_4[1])}return _2},decodeCookie:function(_5){var _6=_5||"";_6=
_6.replace(new RegExp("[+]","g")," ");_6=decodeURIComponent(_6);return _6},encodeHTML:function(_7){var e=this.pseudoDiv;if(typeof e.textContent!="undefined")e.textContent=_7;else e.innerText=_7;return e.innerHTML}}).endType();
vjo.ctype("vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteCache").needs("vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteEncoder").protos({oCache:{},oIdx:{},oRef:{},oLeaf:{},oEncoder:null,UN:"undefined",TFU:"function",TNU:"number",constructs:function(){this.oEncoder=new vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteEncoder},add:function(_1){try{var t=this;var cacheItem=t.oCache[kw];var kw;var kwL;var laL;var prdL;var tdL;var _3=false;if(_1[0].version){kw=_1[1];kwL=
_1[2].sug?_1[2].sug:_1[2];laL=_1[3];prdL=_1[2].prd;tdL=_1[2].td;_3=true}else{kw=_1[0];kwL=_1[1];laL=_1[2]}if(_3)if(_1.length>=4)t.addItem(kw,kw,"k",kwL,prdL,tdL);else laL=_1[2];else if(_1.length>=3)t.addItem(kw,kw,"k",kwL,null,null);else try{if(typeof kwL[0]=="string"){laL=null;t.addItem(kw,kw,"k",kwL,null,null)}else if(typeof kwL[0]=="object"&&kwL[0]instanceof Array)laL=_1[1]}catch(err){laL=null}if(laL!==null)for(var i=0;i<laL.length;i++){var _5=laL[i];var _6=kw+_5[0];var _7=_5[1];var _8;var _9;
var _a;if(_3){if(_5[2].sug)_8=_5[2].sug;else _8=_5[2];_9=_5[2].prd;_a=_5[2].td}else _8=_5[2];if(typeof _8==t.UN||_8===null){_7="fd";_8=_5[0]}t.addItem(_6,kw,_7,_8,_9,_a)}else t.addItem(kw,kw,"null",null)}catch(e){}},addItem:function(_b,_c,_d,_e,_f,_10){var t=this;_b=_b.toLowerCase();_c=_c.toLowerCase();if(_d=="k"){t.oCache[_b]=t.buildItem("k",typeof _e==t.TNU?""+_e:_e,_f,_10,_c);return t.oCache[_b]}else if(_d=="f"){t.oIdx[_b]=t.buildItem("f",typeof _e==t.TNU?""+_e:_e,_f,_10,_c);return t.oIdx[_b]}else if(_d==
"fd"){t.oRef[_b]=t.buildItem("fd",_e,_f,_10,_c);return t.oRef[_b]}else if(_d=="null"){t.oLeaf[_b]=t.buildItem("null",null,_f,_10,_c);return t.oLeaf[_b]}},buildItem:function(_12,_13,_14,pTd,_16){var _17={type:_12,shortPrefix:_16};if(_13!==null)_17.keyword=_13;if(_14!==null)_17.prd=_14;if(pTd!==null)_17.td=pTd;return _17},get:function(_18,_19){_18=_18.toLowerCase();_19=_19.toLowerCase();var t=this;var cacheItem=t.oCache[_18];var indexItem=t.oIdx[_18];var referenceItem=t.oRef[_18];if(typeof cacheItem!=
t.UN&&typeof cacheItem!=t.TFU)return cacheItem;if(typeof indexItem!=t.UN&&typeof indexItem!=t.TFU)return indexItem;if(typeof referenceItem!=t.UN&&typeof referenceItem!=t.TFU)return referenceItem;if(_19){var _1b=t.oLeaf[_19];if(typeof _1b!=t.UN&&typeof _1b!=t.TFU)return _1b;var _1c=[];for(var _1d in t.oIdx){var _1e=t.oIdx[_1d];if(_1e.shortPrefix==_19)_1c.push(_1d)}_1c.sort();if(_1c.length===0)return null;var _1f=_1c.length-1;for(var i=0;i<_1c.length;i++)if(_18<_1c[i]){_1f=i-1;break}if(_1f<0)_1f=0;
return t.oIdx[_1c[_1f]]}return null}}).endType();
vjo.ctype("vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteConfig").needs("vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteEncoder").protos({oModel:{rootDir:"autofill",listSize:10,delayTime:100,dirDepth:3,noSugShowTime:1500,svcIn:"SVC_GH_IN",svcOut:"SVC_GH_OUT"},defaultAlgo:"1",algoMap:{"1":"f","2":"a"},widthDef:{unit:9,min:{px:235,"char":26},max:{px:400,"char":40}},oEncoder:null,constructs:function(_1){if(_1.version===null&&_1.algorithm===null&&_1.algoVerMap==null)return;this.oEncoder=
new vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteEncoder;this.loadConfig(_1)},loadConfig:function(_2){var t=this;var tM=t.oModel;if(_2.version===null||_2.algorithm===null){tM.version=_2.algoVerMap[t.defaultAlgo];tM.algorithm=t.algoMap[t.defaultAlgo]}else{tM.version=_2.version;tM.algorithm=t.algoMap[_2.algorithm]}tM.trkSuggest=_2.trkSuggest;tM.trkProduct=_2.trkProduct;tM.trkBrandedLogo=_2.trkBrandedLogo;tM.trkRS=_2.trkRS;tM.trkInput=_2.trkInput;tM.trkShow=_2.trkShow;tM.trkHide=_2.trkHide;
tM.roverDomainUrl=_2.roverDomainUrl;tM.containerId=_2.containerId;tM.idList=_2.idList;tM.sugDivId=_2.sugDivId;tM.noSugDivId=_2.noSugDivId;tM.hideLnk=_2.hideLnk;tM.baseURL=_2.baseURL;tM.prdURL=_2.prdBaseURL;tM.siteId=_2.siteId;tM.lastSearch=t.oEncoder.decodeCookie(_2.lastSearch)},updateWidthDef:function(_4){var t=this;var inputWidth=parseInt(_4.offsetWidth,10);t.widthDef.max={px:inputWidth,"char":Math.floor(inputWidth/t.widthDef.unit)-1}},getHideLnk:function(){return this.oModel.hideLnk},getWidthUnit:function(){return this.widthDef.unit},
getWidthMin:function(){return this.widthDef.min},getWidthMax:function(){return this.widthDef.max},getRootDir:function(){return this.oModel.rootDir},getListSize:function(){return this.oModel.listSize},getDelayTime:function(){return this.oModel.delayTime},getDirDepth:function(){return this.oModel.dirDepth},getAlgorithm:function(){return this.oModel.algorithm},getVersion:function(){return this.oModel.version},getTrkSuggest:function(){return this.oModel.trkSuggest},getTrkProduct:function(){return this.oModel.trkProduct},
getTrkBrandedLogo:function(){return this.oModel.trkBrandedLogo},getTrkRS:function(){return this.oModel.trkRS},getTrkInput:function(){return this.oModel.trkInput},getRoverDomainUrl:function(){return this.oModel.roverDomainUrl},getTrkShow:function(){return this.oModel.trkShow},getTrkHide:function(){return this.oModel.trkHide},getContainerId:function(){return this.oModel.containerId},getIdList:function(){return this.oModel.idList},getKeyUpSvc:function(){return this.oModel.keyUpSvc},getKeyDownSvc:function(){return this.oModel.keyDownSvc},
getInputOverSvc:function(){return this.oModel.inputOverSvc},getUpdInputSvc:function(){return this.oModel.updInputSvc},getFillContentSvc:function(){return this.oModel.fillContentSvc},getInSvc:function(){return this.oModel.svcIn},getOutSvc:function(){return this.oModel.svcOut},getBaseURL:function(){return this.oModel.baseURL},getPrdURL:function(){return this.oModel.prdURL},getSiteId:function(){return this.oModel.siteId},getSugDivId:function(){return this.oModel.sugDivId},getNoSugDivId:function(){return this.oModel.noSugDivId},
getNoSugShowTime:function(){return this.oModel.noSugShowTime},getLastSearch:function(){return this.oModel.lastSearch}}).endType();
vjo.ctype("vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteRequest").needs(["vjo.dsf.XDomainRequest","vjo.dsf.utils.Timer","vjo.dsf.Element","vjo.dsf.ServiceEngine","vjo.dsf.Message","vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteCache","vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteEncoder"]).props({aReqList:[],sRespSvc:"autofill_response",inProcess:false,bInit:false,vX:vjo.dsf.XDomainRequest,uN:"undefined",init:function(_1){var t=this;if(t.bInit)return;t.oConfig=
{baseURL:_1.baseURL,dirDepth:_1.dirDepth,rootDir:_1.rootDir,algorithm:_1.algorithm,version:_1.version,siteId:_1.siteId};t.oCache=new vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteCache;t.oEncoder=new vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteEncoder;t.oProcessTimer=new vjo.dsf.utils.Timer;t.oProcessTimer.setInterval(20);t.oProcessTimer.onTick=function(){if(t.inProcess)return;t.inProcess=true;try{t.processQue();t.cleanQue()}catch(e){}t.inProcess=false};t.oProcessTimer.start();
t.bInit=true},processQue:function(){var t=this;if(t.aReqList.length===0)return;var _4=t.aReqList[0];if(_4&&_4.state=="wait"){t.aReqList[0].state="process";var _5=t.vX.bUseIframe;try{t.vX.bUseIframe=false;t.aReqList[0].scriptId=t.vX.send(_4.url,false)}catch(e){}t.vX.bUseIframe=_5}},cleanQue:function(){var t=this;var _7=[];var i;for(i=0;i<t.aReqList.length;i++){var _8=t.aReqList[i];if(_8.state=="wait")_7.push(_8);else if(_8.state=="process"){var _9=new Date;var time=_9.getTime()-_8.timestamp;if(time>=
1E3){t.removeScriptTag(_8.scriptId);t.sendRespService(true,_8.requester,_8.prefix,null,null,_8.shortPrefix)}else _7.push(_8)}}t.aReqList=_7},removeScriptTag:function(_a){try{if(window.XMLHttpRequest!=undefined||ActiveXObject==undefined)this.vX.getReqDiv().removeChild(vjo.dsf.Element.get(_a))}catch(e){}},getRespSvc:function(){return this.sRespSvc},getShortPrefix:function(_b){return _b.substr(0,this.oConfig.dirDepth+1)},buildPath:function(_c,_d){var t=this;var pd=_d?1E4:t.oConfig.dirDepth;var _f=_c.length>
pd?_c.substr(0,pd):_c.substr(0,_c.length-1);var _10=_c.length>pd?_c.substr(pd,1):_c.substr(_c.length-1,1);var _11="";var _12=_f.toLowerCase();var _13=_10.toLowerCase();for(var i=0;i<_12.length;i++)_11+=t.oEncoder.encode(_12.charAt(i))+"/";return[_11,t.oEncoder.encode(_13),_f+_10]},buildURL:function(){var t=this;var tO=t.oConfig;var url=tO.baseURL;var href=document.location+"";if(href.search(/^https/g)!=-1){url=url.replace(/http:\/\/include/g,"https://secureinclude");url=url.replace(/com:80/g,"com")}if(typeof tO.version==
t.uN||tO.version===null)return null;if(url.lastIndexOf("/")<url.length-1)url+="/";url+=tO.rootDir+"/";url+=tO.algorithm+"/";url+=tO.siteId+"/";url+=tO.version+"/";return url},addRequest:function(_16,_17,_18,_19){var t=this;var url=t.buildURL();var _1c=t.buildPath(_17,_18=="fd");if(url===null)return;if(url.lastIndexOf("/")<url.length-1)url+="/";url+=_1c[0]+_1c[1];if(_18=="f"&&typeof _19!=t.uN&&_19.length>0)url+=_19;url+=".js";var _1d=new Date;t.aReqList.push({requester:_16,prefix:_17,shortPrefix:t.getShortPrefix(_17),
url:url,state:"wait",timestamp:_1d.getTime(),type:_18})},send:function(_1e,_1f){var t=this;if(!t.bInit)return;var _21=t.getShortPrefix(_1f);var _22=t.oCache.get(_1f,_21);if(_22===null)t.addRequest(_1e,_1f,"k");else if(_22.type=="f"||_22.type=="fd")t.addRequest(_1e,_1f,_22.type,_22.keyword);else if(_22.type=="null")t.sendRespService(true,_1e,_1f,[],[],_21,[]);else t.sendRespService(false,_1e,_1f,_22.keyword,[],_21,_22.prd,_22.td)},sendRespService:function(_23,_24,_25,_26,_27,_28,_29,_2a){var m=new vjo.dsf.Message(this.sRespSvc);
if(_23)m.clientContext={timeout:true,prefix:_25,shortPrefix:_28,requestId:_24};else m.clientContext={timeout:false,prefix:_25,shortPrefix:_28,requestId:_24,kwList:_26,laList:_27,prdList:_29,tdList:_2a};vjo.dsf.ServiceEngine.handleRequest(m)},handleResponse:function(_2c){var t=this;var i;var kw;var pKwList;var pLaList;var pPrdList;var pTdList;if(_2c[0].version){kw=_2c[1];pKwList=_2c[2].sug;pLaList=_2c[3];pPrdList=_2c[2].prd;pTdList=_2c[2].td}else{kw=_2c[0];pKwList=_2c[1];pLaList=_2c[2]}if(!t.bInit)return;
t.oCache.add(_2c);var _2e=[];for(i=0;i<t.aReqList.length;i++){var _2f=t.aReqList[i];if(_2f.state!="process")continue;if(_2f.prefix.toLowerCase()==_2f.shortPrefix.toLowerCase()){if(_2f.prefix.toLowerCase()==kw.toLowerCase()){_2f.state="done";t.removeScriptTag(_2f.scriptId);t.sendRespService(false,_2f.requester,kw,pKwList,pLaList,_2f.shortPrefix,pPrdList,pTdList)}}else if(_2f.shortPrefix.toLowerCase()==kw.toLowerCase()){var _30=t.oCache.get(_2f.prefix,_2f.shortPrefix);_2f.state="done";t.removeScriptTag(_2f.scriptId);
if(_2f.type=="f"&&_30.type!="k"||!_30)t.sendRespService(true,_2f.requester,_2f.prefix,null,null,_2f.shortPrefix,pPrdList,pTdList);else _2e.push(_2f)}}for(i=0;i<_2e.length;i++){var _31=_2e[i];t.send(_31.requester,_31.prefix)}}}).inits(function(){}).endType();
vjo.ctype("vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteLayer").needs(["vjo.dsf.Element","vjo.dsf.utils.Object","vjo.dsf.document.Shim","vjo.dsf.EventDispatcher","vjo.dsf.Message","vjo.dsf.ServiceEngine","vjo.dsf.cookie.VjCookieJar","vjo.dsf.window.utils.VjWindowUtils","vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteEncoder"]).needs("vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteRequest","R").props({_do:function(_1){vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteRequest.handleResponse(_1)}}).protos({cKw:"",
lKw:"",cSel:-1,cKwL:[],cTdL:[],bInSugDiv:false,oRequest:null,blQryEpt:false,oEncoder:null,VE:vjo.dsf.Element,VED:vjo.dsf.EventDispatcher,VS:vjo.dsf.ServiceEngine,reqId:null,oConfig:null,prdDiv:null,prdItms:null,tdDivWraper:null,tdDiv:null,tdItms:null,constructs:function(_2,_3){var t=this;var _5=t.VED;var vS=t.VS;t.oRequest=t.vj$.R;t.oEncoder=new vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteEncoder;t.reqId=_3;t.oConfig=_2;vS.registerSvcHdl(t.oRequest.getRespSvc(),vjo.hitch(t,this.handleResp));
_5.add(_2.getContainerId(),"mouseover",function(){t.bInSugDiv=true});_5.add(_2.getContainerId(),"mouseout",function(){t.bInSugDiv=false});_5.addEventListener(window,"resize",t.onWindowResize,t);var _7=t.VE.get("_nkw_id")?"_nkw_id":"_nkw";_5.addEventListener(_7,"keydown",t.onEntSbmt,t);try{t.VE.promoteToBody(_2.getContainerId())}catch(e){}_5.add(_2.getHideLnk(),"click",function(_8){t.setHideSuggestion(true);t.selectSug(null);t.showSugDiv(false);t.setAutoComplete(true);t.showIcon(true);var _9=function(){t.createTrackingImg(t.oConfig.getRoverDomainUrl()+
t.oConfig.getTrkHide())};window.setTimeout(_9,500);return false});vS.registerSvcHdl(_2.getOutSvc(),function(_a){var _b=_a.clientContext;t.setInput(_b.src);switch(_b.type){case "kw_keyup":t.kw_keyup(_b);break;case "kw_blur":t.kw_blur(_b);break;case "kw_keydown":t.kw_keydown(_b);break;case "kw_mouseover":t.kw_mouseover(_b);break;case "show_click":t.show_click(_b);break}});t.prdDiv=t.VE.get("prdDivWrp");t.prdItms=[];var _c=t.prdDiv.getElementsByTagName("tr");for(var i=0;i<_c.length;i++){var _e={};_e.tr=
_c[i];var _f=_c[i].getElementsByTagName("td");_e.imgTd=_f[0];_e.titleTd=_f[1];t.prdItms.push(_e)}t.tdDivWraper=t.VE.get("tdDivWrp");t.tdDiv=t.VE.get("tdDiv");t.tdItms=[];_f=t.tdDiv.getElementsByTagName("div");for(i=0;i<_f.length;i++)t.tdItms.push(_f[i]);t.updTrk(_2.getTrkInput());t.setAutoComplete(t.isHideSuggestion(),true)},handleResp:function(_10){var t=this;var cfg=t.oConfig;var ctx=_10.clientContext;var _12=cfg.getIdList();var id;for(var i=0;i<_12.length;i++){id=_12[i];t.VED.unregister(id,"mouseover")}var _14=
ctx.kwList||[];var _15=ctx.laList||[];var _16=ctx.prdList||[];var _17=ctx.tdList||[];if(t.reqId!=ctx.requestId||ctx.prefix.toLowerCase()!=t.getInputValue().toLowerCase())return;var _18=t.getRecentSearch();if(_18&&_18.length>0){var _19=_18.toLowerCase();var _1a=_19.indexOf(t.cKw.toLowerCase());var _1b=false;var _1c=_19;for(var _1d=0;_1a>=0;){if(t.isWordStart(_19,_1a+_1d)){_1b=true;break}_1d=_1a+1;_1c=_1c.substr(_1a+1);_1a=_1c.indexOf(t.cKw.toLowerCase())}if(_1b){var _1e=[];_1e.push(_18);for(i=0;i<
_14.length;i++)if(_14[i].toLowerCase()!=_19)_1e.push(_14[i]);if(_1e.length>cfg.getListSize())_1e.pop();_14=_1e}}if(ctx.timeout&&ctx.prefix==t.cKw&&_14.length<1){if(!t.blQryEpt){t.showNoSugMessage(true);t.showSugDiv(true,cfg.getWidthMin().px)}else t.showSugDiv(false);t.blQryEpt=true;return}t.blQryEpt=false;t.showNoSugMessage(false);t.cSel=-1;t.cKwL=[];_12=cfg.getIdList();var _1f=_12.length;if(_1f>cfg.getListSize())_1f=cfg.getListSize();if(t.oInput)cfg.updateWidthDef(t.oInput);var _20=t.getMaxKwLength(_14,
_1f)*cfg.getWidthUnit();if(_20<cfg.getWidthMin().px)_20=cfg.getWidthMin().px;else if(_20>cfg.getWidthMax().px)_20=cfg.getWidthMax().px;for(i=0;i<_1f;i++){var en=_12[i];var e=t.VE.get(en);if(e===null)continue;e.className="unsel";if(i<_14.length){e.innerHTML=t.genKwHTML(_14[i],t.cKw,cfg.getWidthMax()["char"]);t.VE.toggleHideShow(en,true);var trk=_14[i]==_18?cfg.getTrkRS():cfg.getTrkSuggest();t.cKwL[i]={divId:en,sugKw:_14[i],trk:trk,type:"kw"}}else t.VE.toggleHideShow(en,false)}var _23=_16.length;if(_23>
0&&(""+document.location).search(/https:/g)==-1){t.prdDiv.style.display="block";for(i=0;i<t.prdItms.length;i++){var _24=t.prdItms[i];if(_16[i]){_24.tr.style.display="block";_24.tr.className="unsel";_24.imgTd.innerHTML=_16[i][2]?"<img width='32px' src='"+_16[i][2]+"' />":"";_24.titleTd.innerHTML=t.genPrdHtml(_16[i][1],t.cKw,cfg.getWidthMax()["char"]);t.cKwL.push({divId:_24.tr.id,sugKw:t.getInputValue(),trk:cfg.getTrkProduct(),type:"prd",pid:_16[i][0]})}else _24.tr.style.display="none"}}else t.prdDiv.style.display=
"none";var _25=_17.length;if(_25>0&&(""+document.location).search(/https:/g)==-1){t.tdDivWraper.style.display="block";for(i=0;i<t.tdItms.length;i++){var _26=t.tdItms[i];if(_17[i]){_26.style.display="block";_26.innerHTML="<img src='"+_17[i][1]+"' />";_26.className="unsel";t.cKwL.push({divId:_26.id,sugKw:t.getInputValue(),trk:cfg.getTrkBrandedLogo(),type:"td",url:_17[i][2]});if(_17[i][1]!=t.cTdL[i]){t.cTdL[i]=_17[i][1];var _27=t.oConfig.getRoverDomainUrl()+"/roverimp/0/0/9/?imp=5276&trknvp=kw%3D"+t.getInputValue()+
"%26rpg%3D"+_GlobalNavHeaderSrcPageId+"%26td%3D"+_17[i][0];t.createTrackingImg(_27)}}else{_26.style.display="none";t.cTdL[i]=null}}}else{t.tdDivWraper.style.display="none";t.cTdL=[]}t.showSugDiv(true,_20)},getInputValue:function(){var t=this;return t.oInput?t.oInput.value:""},isHideSuggestion:function(){var vC=vjo.dsf.cookie.VjCookieJar;var pbf=vC.readCookie("dp1","pbf");var bit=vC.getBitFlag(pbf,29);return bit==1},setHideSuggestion:function(_2a){var vC=vjo.dsf.cookie.VjCookieJar;var pbf=vC.readCookie("dp1",
"pbf");vC.writeCookielet("dp1","pbf",vC.setBitFlag(pbf,29,_2a?1:0))},getRecentSearch:function(){var lss=this.oConfig.getLastSearch();if(lss!==null&&lss.length>0){lss=lss.substring(lss.indexOf(".")+1);return lss}return""},getMaxKwLength:function(_2d,_2e){if(!_2d)return 0;var max=0;var _30=_2d.length;if(_30>_2e)_30=_2e;for(var i=0;i<_30;i++){var len=_2d[i].length;if(len>max)max=len}return max},isWordStart:function(pKw,_34){if(_34<=0||_34>pKw.length-1)return true;var _35=new RegExp("[\\s \\.,]");return pKw.substr(_34-
1,1).search(_35)>=0},genKwHTML:function(pKw,_37,_38){var _39=_37.length;var out=pKw;var t=this;var _3b=t.oEncoder;var part;var _3c=-1;for(var i=0;i<pKw.length;i++){part=pKw.substr(i,_39);if(part.length!=_39)break;if(part.toLowerCase()==_37.toLowerCase()&&t.isWordStart(pKw,i)){_3c=i;break}}var _3e=pKw.substring(0,_3c);var _3f=pKw.substr(_3c+_39);var _40;if(_3c>=0)if(pKw.length>_38)if(_3e.length>_38){out=_3b.encodeHTML(out.substr(0,_38));out+="..."}else if(_3e.length+part.length>_38){_40=_38-_3e.length;
part="<span class='hl'>"+_3b.encodeHTML(part.substr(0,_40))+"...</span>";out=_3b.encodeHTML(_3e)+part}else{_40=_38-_3e.length-part.length;out=_3b.encodeHTML(_3e)+"<span class='hl'>"+_3b.encodeHTML(part)+"</span>"+_3b.encodeHTML(_3f.substr(0,_40))+"..."}else out=_3b.encodeHTML(_3e)+"<span class='hl'>"+_3b.encodeHTML(part)+"</span>"+_3b.encodeHTML(_3f);else if(pKw.length>_38){out=_3b.encodeHTML(out.substr(0,_38));out+="..."}return out},genPrdHtml:function(_41,_42,_43){var kws=_42.split(/\s/);var out=
_41.length>75?_41.substr(0,75)+"...":_41;for(var i=0;i<kws.length;i++)if(kws[i]!=""){var reg=new RegExp(kws[i],"i");out=out.replace(reg,"<-"+_41.substr(_41.search(reg),kws[i].length)+"->")}out=out.replace(/<-/g,"<span class='hl'>");out=out.replace(/->/g,"</span>");return out},startKeyTimer:function(_48){var t=this;t.stopKeyTimer();var _4a=function(){var _4b=t.getInputValue();if(_48!=_4b||_4b.length<1)return;t.oRequest.send(t.reqId,_48)};t.oKeyTimer=window.setTimeout(_4a,t.oConfig.getDelayTime())},
stopKeyTimer:function(){var t=this;if(t.oKeyTimer){window.clearTimeout(t.oKeyTimer);t.oKeyTimer=null}},getKwSelect:function(){var t=this;if(t.cSel<0)return t.cKw;return t.cKwL[t.cSel].sugKw},selectSug:function(_4e,_4f,_50){var t=this;var kw=t.cKw;if(t.cSel>=0)t.unselectSug(t.cKwL[t.cSel].divId);if(_4e!==null){var e=t.VE.get(_4e);for(var i=0;i<t.cKwL.length;i++){var _54=t.cKwL[i];if(_54.divId==_4e){t.cSel=i;kw=_54.sugKw;break}}if(e)e.className="sel"}else t.cSel=-1;if(!_50)t.updateInput(kw);if(!_4f)t.focusInput()},
unselectSug:function(_55){var t=this;var e=t.VE.get(_55);if(e)e.className="unsel"},createTrackingImg:function(_57){var _58=new Date;var r=_58.getTime();var _59=_57;if(_59.indexOf("?")>0)_59+="&"+r;else _59+="?"+r;var img=new Image;document.getElementsByTagName("body")[0].appendChild(img);img.setAttribute("src",_59);img.setAttribute("width","1");img.setAttribute("height","1");img.setAttribute("border","0")},sendInSvc:function(_5b){var m=new vjo.dsf.Message(this.oConfig.getInSvc());m.clientContext=
_5b;this.VS.handleRequest(m)},isCtrlKey:function(_5d){var _5e=[38,39,40,27];for(var i=0;i<_5e.length;i++)if(_5e[i]==_5d)return true;return false},isIgnorKey:function(_60){var _61=[16,17,18];for(var i=0;i<_61.length;i++)if(_60==_61[i])return true;return false},isSugShown:function(){var t=this;var _64=t.VE.get(t.oConfig.getContainerId());var disp=_64.currentStyle?_64.currentStyle.display:window.getComputedStyle(_64,null).getPropertyValue("display");return disp!="none"},isNoSugMsgShow:function(){var t=
this;var _66=t.VE.get(t.oConfig.getNoSugDivId());var disp=_66.currentStyle?_66.currentStyle.display:window.getComputedStyle(_66,null).getPropertyValue("display");return disp!="none"},showNoSugMessage:function(_67){var t=this;t.VE.toggleHideShow(t.oConfig.getSugDivId(),!_67);t.VE.toggleHideShow("prdDivWrp",!_67);t.VE.toggleHideShow("tdDivWrp",!_67);t.VE.toggleHideShow(t.oConfig.getNoSugDivId(),_67);if(_67){var _69=function(){if(t.isNoSugMsgShow())t.showSugDiv(false)};window.setTimeout(_69,t.oConfig.getNoSugShowTime())}},
showSugDiv:function(_6a,_6b){var t=this;if(t.isHideSuggestion()&&_6a){t.showIcon(true);return}var vS=vjo.dsf.document.Shim;var _6e=t.oConfig.getContainerId();var _6f=t.VE.get(_6e);if(_6a){t.posLayer(_6b);t.VE.toggleHideShow(_6e,true);if(t.oIframeShim)vS.remove(_6f,t.oIframeShim);t.oIframeShim=vS.add(_6f);var _70=function(){t.regOverEvent(true)};window.setTimeout(_70,100)}else{t.VE.toggleHideShow(_6e,false);if(t.oIframeShim){vS.remove(_6f,t.oIframeShim);t.oIframeShim=null}t.regOverEvent(false)}},onEntSbmt:function(e){var t=
this;var idx=t.cSel;if(e.keyCode==13&&idx>-1){var _73=t.cKwL[idx].type;var trk=t.cKwL[idx].trk;var pid=t.cKwL[idx].pid;var url=t.cKwL[idx].url;if(url){var _74=trk?(url.indexOf("?")>=0?"&":"?")+"_trksid="+trk:"";document.location.href=url+_74;return false}else if(pid){_74=trk?"&_trksid="+trk:"";t.VED.stopEvent(e);document.location.href=t.oConfig.getPrdURL()+"/?_pid="+pid+_74;return false}}},regOverEvent:function(_75){var t=this;var _77=t.oConfig.getIdList();var id;for(var i=0;i<_77.length;i++){id=
_77[i];t.VED.unregister(id,"mouseover");t.VED.detachHandlers(id,"mouseover");t.VED.unregister(id,"click");t.VED.detachHandlers(id,"click");if(_75){t.VED.add(id,"mouseover",function(_79){t.bInSugDiv=true;t.selectSug(_79.src.id,false,false)});t.VED.add(id,"click",function(_7a){var _7b=_7a.src.attributes;var type;var trk;var pid;var url;for(var j=0;j<t.cKwL.length;j++)if(t.cKwL[j].divId==_7a.src.id){type=t.cKwL[j].type;trk=t.cKwL[j].trk;pid=t.cKwL[j].pid;url=t.cKwL[j].url;break}if(type=="prd"){if(pid){var _7d=
trk?"&_trksid="+trk:"";document.location.href=t.oConfig.getPrdURL()+"/?_pid="+pid+_7d}}else if(type=="td"){_7d=trk?(url.indexOf("?")>=0?"&":"?")+"_trksid="+trk:"";document.location.href=url+_7d}else{t.selectSug(_7a.src.id);t.submitForm();t.showSugDiv(false)}})}}},posLayer:function(_7e){var t=this;var gap;var _80=t.getAbsPos(t.oInput);if(_80===null)return false;var e=t.VE.get(t.oConfig.getContainerId());if(e===null)return false;gap=vjo.dsf.client.Browser.bIE?2:0;e.style.left=_80.left-gap+"px";e.style.top=
_80.top+_80.height-gap+"px";if(typeof _7e!="undefined"&&_7e!==null)e.style.width=parseInt(_7e,10)+"px";return true},getAbsPos:function(_82){var vW=vjo.dsf.window.utils.VjWindowUtils;var t=this;if(_82===null)return null;return{left:parseInt(vW.offsetLeft(_82),10),top:parseInt(vW.offsetTop(_82),10),height:parseInt(_82.offsetHeight,10),width:parseInt(_82.offsetWidth,10)}},updateInput:function(pKw){var t=this;if(t.isSugShown()){t.lKw=pKw;t.sendInSvc({type:"kw_updvalue",value:pKw})}},updTrk:function(_86){this.sendInSvc({type:"search_updtrk",
lnkStr:_86})},submitForm:function(){var t=this;if(t.cSel>=0){var trk=t.cKwL[t.cSel].trk;t.updTrk(trk)}this.sendInSvc({type:"search_submit"})},showIcon:function(_89){this.sendInSvc({type:"sug_icon_show",bShow:_89})},focusInput:function(){this.sendInSvc({type:"kw_focus"})},setAutoComplete:function(bOn,_8b){this.sendInSvc({type:"kw_autocomplete",bOn:bOn,bSkipFocus:_8b})},setInput:function(_8c){if(!_8c)return;var t=this;if(!t.oInput)t.oInput=_8c;t.oConfig.updateWidthDef(_8c)},show_click:function(_8e){var t=
this;t.showIcon(false);t.setHideSuggestion(false);t.blQryEpt=false;t.oRequest.send(t.reqId,t.getInputValue());var _90=function(){t.createTrackingImg(t.oConfig.getRoverDomainUrl()+t.oConfig.getTrkShow())};window.setTimeout(_90,500);t.setAutoComplete(false)},kw_blur:function(_91){var t=this;if(t.isSugShown()&&!t.isNoSugMsgShow())if(!t.bInSugDiv){var _93=t.cSel>=0?t.cKwL[t.cSel].divId:null;t.showSugDiv(false);t.unselectSug(_93)}else t.focusInput()},kw_mouseover:function(_94){var t=this;if(t.isSugShown()&&
!t.isNoSugMsgShow())t.selectSug(null)},kw_keydown:function(_96){var t=this;var kc=_96.keyCode;if((kc==13||kc==9)&&t.isSugShown()&&!t.isNoSugMsgShow()){if(t.cSel>=0)t.updTrk(t.cKwL[t.cSel].trk);t.showSugDiv(false)}},kw_keyup:function(_98){var t=this;var kc=_98.keyCode;var cv=_98.value;if(t.isIgnorKey(kc))return;if(t.isSugShown()&&!t.isNoSugMsgShow())if(t.isCtrlKey(kc)){var e;var _9b;var _9c;switch(kc){case 38:_9b=t.cSel-1;if(_9b<-1)_9b=t.cKwL.length-1;_9c=_9b>=0?t.cKwL[_9b].divId:null;t.selectSug(_9c);
t.cSel=_9b;break;case 40:_9b=t.cSel+1;if(_9b>=t.cKwL.length)_9b=-1;_9c=_9b>=0?t.cKwL[_9b].divId:null;t.selectSug(_9c);break;case 39:if(cv.length!==0){t.cKw=cv;t.startKeyTimer(cv);t.lKw=cv}break;case 27:t.selectSug(null);t.showSugDiv(false);break}}else if(cv.length!==0){if(t.lKw!=cv){t.cKw=cv;t.startKeyTimer(cv);t.lKw=cv}}else{t.showSugDiv(false);t.showIcon(false);t.cKw=cv;t.lKw=cv;t.blQryEpt=false}else if(cv.length!==0){if(t.lKw!=cv){t.cKw=cv;t.startKeyTimer(cv);t.lKw=cv}}else{t.cKw=cv;if(t.isHideSuggestion())t.showIcon(false);
t.lKw=cv;t.blQryEpt=false}},onWindowResize:function(_9d){if(this.isSugShown())this.showSugDiv(true)}}).endType();
vjo.ctype("vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteLayerInit").needs(["vjo.dsf.ServiceEngine","vjo.dsf.EventDispatcher","vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteConfig","vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteLayer","vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteRequest","vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteLayerLazyInit"]).protos({oModel:null,constructs:function(_1){this.oModel=_1;var t=this;var _3=function(){var _4=
new vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteConfig(t.oModel);var _5={baseURL:_4.getBaseURL(),dirDepth:_4.getDirDepth(),rootDir:_4.getRootDir(),algorithm:_4.getAlgorithm(),version:_4.getVersion(),siteId:_4.getSiteId()};vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteRequest.init(_5);new vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteLayer(_4,t.oModel.requestId)};vjo.dsf.EventDispatcher.addEventListener(window,"load",_3,window);vjo.ctype("vjo.darwin.domain.finding.autofill.AutoFill").props({_do:function(_6){vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteLayer._do(_6)}})}}).props({init:function(_7){new vjo.darwin.core.ebayheader.autocomplete.layer.AutoCompleteLayerInit(_7)}}).inits(function(){this.vj$.AutoCompleteLayerLazyInit.callback()}).endType();

