PageSourceSearch

https://www.mysafetylabels.com/js/ui-xp5_search_ultra.js?v=2026-38

js mysafetylabels.com collected 2026-09-24 21:29:15 UTC 77,573 bytes, 1,928 lines download raw bytes

1var _xp5SearchUltra = true; // this var used to check weather this js file loaded or not.
2var xslowconnection = false
3var xtypingexpert = false
4
5var xhidesearchhelp = true;
6var IEBrowser = false;
7var retval = false;
8var IsSearchUltra_azure = true;
9
10function browserCheck(regExprtn) {
11    var xp5_searchjs_agt = navigator.userAgent;
12    if (xp5_searchjs_agt.length > 0) {
13        xp5_searchjs_agt = xp5_searchjs_agt.toLowerCase();
14        if (new RegExp(regExprtn).test(xp5_searchjs_agt)) {
15            return true;
16        }
17        else { return false; }
18    }
19
20}
21
22var bd_agent = navigator.userAgent;
23if (bd_agent.length > 0) {
24    bd_agent = bd_agent.toLowerCase();
25}
26if ((/msie (\d+\.\d+);/.test(bd_agent)) || (new RegExp("trident/7.*rv:11").test(bd_agent))) { //test for MSIE x.x;
27    var ieversion = new Number(RegExp.$1) // capture x.x portion and store as a number
28    xhidesearchhelp = false   //only using help search for IE, for now.
29    IEBrowser = true;
30}
31IEBrowser = true;
32
33var xbrowser = ""
34if (bd_agent.indexOf("firefox") >= 0) {
35    xbrowser = "firefox"
36}
37else if (bd_agent.indexOf("chrome") >= 0) {
38    xbrowser = "chrome"
39}
40else if (bd_agent.indexOf("msie") >= 0) {
41    xbrowser = "msie"
42}
43else if (bd_agent.indexOf("safari") >= 0) {
44    xbrowser = "safari"
45}
46
47var xhidesearchhelp = false
48var ShowImageSection = true;
49
50//<br>You may use Down & Up arrow keys to move the keyword selector.
51function ApplySearchVariationFlag() {
52    if (typeof window.variationSearch != 'undefined' && window.variationSearch === true) {
53        if (searchobj) {
54            var xfield = searchobj.elements ? searchobj.elements["search_variation"] : null
55            if (!xfield) {
56                xfield = document.createElement("input")
57                xfield.type = "hidden"
58                xfield.name = "search_variation"
59                searchobj.appendChild(xfield)
60            }
61            xfield.value = "1"
62        }
63    }
64}
65
66function validatesearch(ycurrsearchsection) {
67    if (ycurrsearchsection) {   //.length > 0
68        InitSearchObjects(ycurrsearchsection)
69    }
70    else if (currsearchsection.length > 0) {
71        InitSearchObjects(currsearchsection)
72    }
73    else {
74        InitSearchObjects('search')
75    }
76
77    ApplySearchVariationFlag()
78
79    if (LastSelWord.length > 0) {
80        var a_wordval = LastSelWord.split('^')
81        if (document.getElementById(searchdiv).style.display == "block") {
82            if ((searchobj.txtsearch.value.length <= a_wordval[0].length && a_wordval[0].length > 0 && searchobj.txtsearch.value.length > 0) || xForceApply) {
83                //if (a_wordval[0].toLowerCase().indexOf(searchobj.txtsearch.value.toLowerCase()) >= 0  || xForceApply) {
84                if ($("#autoSuggest").length > 0 && trimstr(a_wordval[0].toLowerCase()) != trimstr(searchobj.txtsearch.value.toLowerCase())) {
85                    searchobj.txtsearch.value = trimstr(a_wordval[0])
86                }
87                else if (trimstr(a_wordval[0].toLowerCase()) == trimstr(searchobj.txtsearch.value.toLowerCase()) || xForceApply) {
88                    searchobj.txtsearch.value = trimstr(a_wordval[0])
89                }
90            }
91        }
92    }
93    searchobj.txtsearch.value = trimstr(searchobj.txtsearch.value)
94
95    if (searchobj.txtsearch.value.length == 0) {
96        alert('Please enter search criteria...')
97        return false
98    }
99    if (searchobj.txtsearch.value.length <= 2 && searchobj.txtsearch.value.toUpperCase() !== "W9") {
100        alert('Please enter at least 3 characters...')
101        return false
102    }
103    if (searchobj.txtsearch.value.length > 100) {
104        searchobj.txtsearch.value = searchobj.txtsearch.value.substring(0, 100)
105    }
106    var xtxtsearch = searchobj.txtsearch.value.split(' ').join('_').split('+').join('_').split(',').join('_')
107    //var xtxtsearch = searchobj.txtsearch.value.split(' ').join('+')//.split('+').join('_')
108    if (document.productsearchbar) {
109        var xWP3CharCode = document.productsearchbar.WP3CharCode.value
110    } else {
111        var xWP3CharCode = 'SMT'
112    }
113
114    var xparam = ""
115    if (document.preview) {
116        if (document.preview.free) {
117            if (document.preview.free.value.length > 0) {
118                xparam = "?free=1"
119            }
120        }
121        if (document.preview.sfc) {
122            if (document.preview.sfc.value.length > 0) {
123                if (xparam.length > 0) {
124                    xparam = xparam + "&"
125                }
126                else {
127                    xparam = "?"
128                }
129                xparam = xparam + 'sfc=' + document.preview.sfc.value
130            }
131        }
132        if (document.preview.sfv) {
133            if (document.preview.sfv.value.length > 0) {
134                if (xparam.length > 0) {
135                    xparam = xparam + "&"
136                }
137                else {
138                    xparam = "?"
139                }
140                xparam = xparam + 'sfv=' + document.preview.sfv.value
141            }
142        }
143        if (document.preview.sflc) {
144            if (document.preview.sflc.value.length > 0) {
145                if (xparam.length > 0) {
146                    xparam = xparam + "&"
147                }
148                else {
149                    xparam = "?"
150                }
151                xparam = xparam + 'sflc=' + document.preview.sflc.value
152            }
153        }
154        if (document.preview.sfuc) {
155            if (document.preview.sfuc.value.length > 0) {
156                if (xparam.length > 0) {
157                    xparam = xparam + "&"
158                }
159                else {
160                    xparam = "?"
161                }
162                xparam = xparam + 'sfuc=' + document.preview.sfuc.value
163            }
164        }
165        if (document.preview.sfuv) {
166            if (document.preview.sfuv.value.length > 0) {
167                if (xparam.length > 0) {
168                    xparam = xparam + "&"
169                }
170                else {
171                    xparam = "?"
172                }
173                xparam = xparam + 'sfuv=' + document.preview.sfuv.value
174            }
175        }
176    }
177    if (document.frmFilter) {
178        if (document.frmFilter.lstRel) {
179            if (document.frmFilter.lstRel.value.length > 0) {
180                if (xparam.length > 0) {
181                    xparam = xparam + "&"
182                }
183                else {
184                    xparam = "?"
185                }
186                xparam = xparam + 'lstrel=' + document.frmFilter.lstRel.value
187            }
188        }
189
190        if (document.frmFilter.chkFT) {
191            if (document.frmFilter.chkFT.checked) {
192                if (xparam.length > 0) {
193                    xparam = xparam + "&"
194                }
195                else {
196                    xparam = "?"
197                }
198                xparam = xparam + 'chkft=1'
199            }
200        }
201
202        if (document.frmFilter.minlist) {
203            if (document.frmFilter.minlist.value.length > 0) {
204                if (xparam.length > 0) {
205                    xparam = xparam + "&"
206                }
207                else {
208                    xparam = "?"
209                }
210                xparam = xparam + "minlist=" + document.frmFilter.minlist.value
211            }
212        }
213        if (document.frmFilter.maxlist) {
214            if (document.frmFilter.maxlist.value.length > 0) {
215                if (xparam.length > 0) {
216                    xparam = xparam + "&"
217                }
218                else {
219                    xparam = "?"
220                }
221                xparam = xparam + "maxlist=" + document.frmFilter.maxlist.value
222            }
223        }
224
225        if (document.frmFilter.minheight) {
226            if (document.frmFilter.minheight.value.length > 0) {
227                if (xparam.length > 0) {
228                    xparam = xparam + "&"
229                }
230                else {
231                    xparam = "?"
232                }
233                xparam = xparam + "minheight=" + document.frmFilter.minheight.value
234            }
235        }
236        if (document.frmFilter.maxheight) {
237            if (document.frmFilter.maxheight.value.length > 0) {
238                if (xparam.length > 0) {
239                    xparam = xparam + "&"
240                }
241                else {
242                    xparam = "?"
243                }
244                xparam = xparam + "maxheight=" + document.frmFilter.maxheight.value
245            }
246        }
247
248        if (document.frmFilter.minwidth) {
249            if (document.frmFilter.minwidth.value.length > 0) {
250                if (xparam.length > 0) {
251                    xparam = xparam + "&"
252                }
253                else {
254                    xparam = "?"
255                }
256                xparam = xparam + "minwidth=" + document.frmFilter.minwidth.value
257            }
258        }
259        if (document.frmFilter.maxwidth) {
260            if (document.frmFilter.maxwidth.value.length > 0) {
261                if (xparam.length > 0) {
262                    xparam = xparam + "&"
263                }
264                else {
265                    xparam = "?"
266                }
267                xparam = xparam + "maxwidth=" + document.frmFilter.maxwidth.value
268            }
269        }
270
271        if (document.frmFilter.minsales) {
272            if (document.frmFilter.minsales.value.length > 0) {
273                if (xparam.length > 0) {
274                    xparam = xparam + "&"
275                }
276                else {
277                    xparam = "?"
278                }
279                xparam = xparam + "minsales=" + document.frmFilter.minsales.value
280            }
281        }
282        if (document.frmFilter.maxsales) {
283            if (document.frmFilter.maxsales.value.length > 0) {
284                if (xparam.length > 0) {
285                    xparam = xparam + "&"
286                }
287                else {
288                    xparam = "?"
289                }
290                xparam = xparam + "maxsales=" + document.frmFilter.maxsales.value
291            }
292        }
293
294        if (document.frmFilter.minqty) {
295            if (document.frmFilter.minqty.value.length > 0) {
296                if (xparam.length > 0) {
297                    xparam = xparam + "&"
298                }
299                else {
300                    xparam = "?"
301                }
302                xparam = xparam + "minqty=" + document.frmFilter.minqty.value
303            }
304        }
305        if (document.frmFilter.maxqty) {
306            if (document.frmFilter.maxqty.value.length > 0) {
307                if (xparam.length > 0) {
308                    xparam = xparam + "&"
309                }
310                else {
311                    xparam = "?"
312                }
313                xparam = xparam + "maxqty=" + document.frmFilter.maxqty.value
314            }
315        }
316
317        if (document.frmFilter.minorders) {
318            if (document.frmFilter.minorders.value.length > 0) {
319                if (xparam.length > 0) {
320                    xparam = xparam + "&"
321                }
322                else {
323                    xparam = "?"
324                }
325                xparam = xparam + "minorders=" + document.frmFilter.minorders.value
326            }
327        }
328        if (document.frmFilter.maxorders) {
329            if (document.frmFilter.maxorders.value.length > 0) {
330                if (xparam.length > 0) {
331                    xparam = xparam + "&"
332                }
333                else {
334                    xparam = "?"
335                }
336                xparam = xparam + "maxorders=" + document.frmFilter.maxorders.value
337            }
338        }
339
340    }
341
342    xtxtsearch = xtxtsearch.split('&').join('_')
343    xtxtsearch = xtxtsearch.split('#').join('_')
344    xtxtsearch = xtxtsearch.split('*').join('')
345    xtxtsearch = xtxtsearch.split('\'').join('')
346    xtxtsearch = xtxtsearch.split('__').join('_')
347    xtxtsearch = xtxtsearch.split('__').join('_')
348    //05212013-as add new char due to error
349    xtxtsearch = xtxtsearch.split('<').join('')
350    xtxtsearch = xtxtsearch.split('>').join('')
351    xtxtsearch = xtxtsearch.split('/').join('_') //10312014JP
352    xtxtsearch = xtxtsearch.split(':').join('') //10312014JP
353
354
355    var urlregex = new RegExp("[^a-zA-Z0-9_+-=~$]");
356    if (urlregex.test(xtxtsearch)) {
357        xtxtsearch = xtxtsearch.replace(/[^a-zA-Z0-9_+-=~$]/gi, '')
358    }
359    document.cookie = "clientScreenWidth=" + $(window).width() + "; Path=/;"
360    var ifSubmitted = false
361    if (document.domain.toLowerCase().indexOf("mydoorsign") > 0 && 1 == 2) {
362        try {
363            if (searchobj.txtsearch) {
364                ga('send', 'pageview', '/search_results?txtsearch=' + searchobj.txtsearch.value);
365            } else {
366                ga('send', 'pageview', '/search_results?txtsearch=' + document.preview.txtsearch.value);
367            }
368        }
369        catch (ex) { }
370    }
371    var regeformat = /[^a-zA-Z0-9_+-=~$@\s"''&½¾™#()%⁄‘’íÍñÑéÉáÁóÓüÜ>\\]/gi
372    if (document.preview) {
373        if (document.preview.sfc) {
374            ifSubmitted = true
375            document.preview.action = '/search/' + xtxtsearch 
376            if (document.preview.txtsearch.value.length > 80) {
377                document.preview.txtsearch.value = document.preview.txtsearch.value.substring(0, 80)
378            }
379            document.preview.txtsearch.value = jsHtmlEncode(document.preview.txtsearch.value.replace(regeformat, ''))
380            if (searchobj.txtsearch) { searchobj.txtsearch.value = jsHtmlEncode(searchobj.txtsearch.value.replace(regeformat, '')) }
381            document.preview.submit()
382            return false;
383        }
384    }
385    if (document.productsearchbar2 && document.productsearchbar2.isplasearchpage && currsearchsection == 'dept') {
386        //in aspx /xp/pla_productspecs is zzz_
387        searchobj.action = '/xp/pla_productspecs.aspx?sku=' + document.productsearchbar2.sku_pla.value
388        searchobj.txtsearch.value = jsHtmlEncode(searchobj.txtsearch.value.replace(regeformat, ''))
389        return true;
390    }
391    if (document.productsearch) {
392        searchobj.action = '/search/' + xtxtsearch + xparam;
393        searchobj.txtsearch.value = jsHtmlEncode(searchobj.txtsearch.value.replace(regeformat, ''))
394        searchobj.submit()
395        return false;
396    }
397    if (!ifSubmitted) {
398        searchobj.action = '/search/' + xtxtsearch + xparam
399        searchobj.txtsearch.value = jsHtmlEncode(searchobj.txtsearch.value.replace(regeformat, ''))
400        return true;
401    }
402}
403
404
405function validateandsubmit() {
406    searchobj.txtsearch.value = trimstr(searchobj.txtsearch.value)
407    if (searchobj.txtsearch.value.length > 80) {
408        searchobj.txtsearch.value = searchobj.txtsearch.value.substring(0, 80)
409    }
410    if (searchobj.txtsearch.value.length == 0) {
411        alert('Please enter search criteria...')
412        return false
413    }
414    if (searchobj.txtsearch.value.length <= 2 && searchobj.txtsearch.value.toUpperCase() !== "W9") {
415        alert('Please enter at least 3 characters...')
416        return false
417    }
418    var xtxtsearch = searchobj.txtsearch.value.split(' ').join('_').split('+').join('_')
419    var xWP3CharCode = document.productsearchbar.WP3CharCode.value
420
421    xtxtsearch = xtxtsearch.split('&').join('_')
422    xtxtsearch = xtxtsearch.split('#').join('_')
423    xtxtsearch = xtxtsearch.split('*').join('')
424    xtxtsearch = xtxtsearch.split('\'').join('')
425    xtxtsearch = xtxtsearch.split('__').join('_')
426    xtxtsearch = xtxtsearch.split('__').join('_')
427
428    searchobj.action = '/search/' + xtxtsearch 
429
430    searchobj.submit()
431}
432
433function trimstr(ystr) {
434    var xfound = false
435    if (ystr.length == 0) return ""
436    for (var k = 0; k < ystr.length; k++) {
437        if (!xfound) {
438            if (ystr.charAt(k) == " ") {
439            }
440            else {
441                ystr = ystr.substring(k, ystr.length)
442                xfound = true
443                break
444            }
445        }
446    }
447    if (!xfound) ystr = ""
448
449    xfound = false
450    if (ystr.length == 0) return ""
451    for (k = ystr.length - 1; k >= 0; k--) {
452        if (!xfound) {
453            if (ystr.charAt(k) == " ") {
454            }
455            else {
456                ystr = ystr.substring(0, k + 1)
457                xfound = true
458                break
459            }
460        }
461    }
462    if (!xfound) ystr = ""
463    return ystr
464}
465
466var xhidesearchhelp = false
467var a_words = new Array();
468var a_images = new Array();
469var a_ctridx = new Array();
470var a_resp = new Array();
471var a_dept = new Array();
472var xResponse = false;
473var xCurrSelRow = 0
474var xMaxSugg = 0
475var LastSelWord = ""
476var timeout;
477var LastWord = ""
478function InitSearchObjects(ycurrsearchsection) {
479    if (currsearchsection.length > 0) {
480        if (currsearchsection != ycurrsearchsection) {
481            WipeCleanSearchHelpBox()
482            if (currsearchsection == 'header') {
483                if (document.productsearchbar) {
484                    if (document.productsearchbar.txtsearch) {
485                        document.productsearchbar.txtsearch.value = ""
486                    }
487                }
488            }
489            else if (currsearchsection == 'home') {
490                if (document.productsearchbar2) {
491                    if (document.productsearchbar2.txtsearch) {
492                        document.productsearchbar2.txtsearch.value = ""
493                    }
494                }
495            }
496            else if (currsearchsection == 'dept') {
497                if (document.productsearchbar2) {
498                    if (document.productsearchbar2.txtsearch) {
499                        document.productsearchbar2.txtsearch.value = ""
500                    }
501                }
502            }
503            else if (currsearchsection == 'search') {
504                if (document.productsearch) {
505                    if (document.productsearch.txtsearch) {
506                        document.productsearch.txtsearch.value = ""
507                    }
508                }
509            }
510
511        }
512    }
513    if ($("#autoSuggest").length > 0) {
514        searchobj = document.productsearch
515        searchdiv = "autoSuggest"
516        document.getElementById("autoSuggest").style.display = "block";
517        searchcontainer = "autoSuggest_container"
518    }
519    else if (ycurrsearchsection == 'search') {
520        searchobj = document.productsearch
521        searchdiv = "divsearchhelp"
522        searchcontainer = "divsearchhelp_container"
523    }
524    else if (ycurrsearchsection == 'header') {
525        searchobj = document.productsearchbar
526
527        if (typeof (searchnewpopup) != 'undefined' && searchnewpopup == true) {
528            searchdiv = "searchResultBox"
529        } 
530        else {
531            searchdiv = "divsearchhelpbar"
532        }
533
534        searchcontainer = "divsearchhelpbar_container"
535    }
536    else if (ycurrsearchsection == 'home') {
537        searchobj = document.productsearchbar2
538        searchdiv = "divsearchhelpbar2"
539        searchcontainer = "divsearchhelpbar2_container"
540    }
541    else if (ycurrsearchsection == 'dept') {
542        searchobj = document.productsearchbar2
543        searchdiv = "divsearchhelpbar2"
544        searchcontainer = "divsearchhelpbar2_container"
545    }
546    else if (ycurrsearchsection == 'topmenu') {
547        searchobj = document.productsearchbar_topmenu
548        searchdiv = "divsearchhelpbar_topmenu"
549        searchcontainer = "divsearchhelpbar_topmenu_container"
550    }
551    else if (ycurrsearchsection == 'PARTIALvalidatesearchbar') {
552        searchobj = document.PARTIALvalidatesearchbar
553        searchdiv = "PARTIALvalidatesearchbar"
554        searchcontainer = "divsearchhelpbar_PARTIALvalidatesearchbar_container"
555    }
556
557}
558function GetSearchHelp(ytext, ycurrsearchsection) {
559
560    xForceApply = false
561    if (ytext.length > 80) {
562        ytext = ytext.substring(0, 80)
563    }
564    InitSearchObjects(ycurrsearchsection)
565    currsearchsection = ycurrsearchsection
566
567    if (document.preview) {
568        if (document.preview.sfc) {
569            if (document.preview.sfc.value.length > 0) {
570                ClearAllFilters(0)
571            }
572        }
573    }
574
575    LastSelWord = ""
576    if (!xhidesearchhelp) {
577        xtext = ""
578
579        if (ytext.length > 0 && LastWord != ytext) {
580            xtext = ytext
581            if (timeout) {
582                clear_timeout()
583            }
584            set_timeout(ytext, xtext)
585        }
586        else if (ytext.length <= 0) {
587            if (timeout) {
588                clear_timeout()
589            }
590            HideSearchHelpBox()
591        }
592        if (ytext.length <= 2) {
593            xhelpctr = 0
594        }
595        LastWord = ytext
596    }
597}
598
599function set_timeout(ytext, xtext) {
600    var timeoutduration
601    xtypingexpert = false
602    xhelpusedpercent = 100
603    if (ytext.length > 2) {
604        if (xhelpctr == 0) {
605            xtypingexpert = true
606            xtypingpercent = 0
607            xhelpusedpercent = 0
608        }
609        else {
610            xhelpusedpercent = ((xhelpctr * 100) / (ytext.length + 0))
611            if (xhelpusedpercent <= 15) {
612                xtypingexpert = true
613
614            }
615        }
616    }
617    if (xslowconnection) {
618        timeoutduration = 1250
619    }
620    else if (xbrowser == "firefox" || xbrowser == "") {
621        timeoutduration = 1250
622    }
623    else if (xtypingexpert) {
624        if (xhelpusedpercent < 5) {
625            timeoutduration = 700
626        }
627        else if (xhelpusedpercent < 10) {
628            timeoutduration = 550
629        }
630        else {
631            timeoutduration = 400
632        }
633    }
634    else {
635        if (xhelpusedpercent < 30) {
636            timeoutduration = 300
637        }
638        else if (xhelpusedpercent < 40) {
639            timeoutduration = 250
640        }
641        else if (xhelpusedpercent < 50) {
642            timeoutduration = 200
643        }
644        else if (xhelpusedpercent < 60) {
645            timeoutduration = 175
646        }
647        else if (xhelpusedpercent < 70) {
648            timeoutduration = 150
649        }
650        else {
651            timeoutduration = 150
652        }
653
654
655    }
656   
657    if (IsSearchUltra_azure) {
658        timeout = setTimeout('DisplaySearchHelp_az("' + ytext + '", "' + xtext + '")', 300)
659    }
660    else {
661        timeout = setTimeout('DisplaySearchHelp("' + ytext + '", "' + xtext + '")', timeoutduration)
662    }
663
664}
665
666function clear_timeout() {
667    clearTimeout(timeout)
668}
669
670function DisplaySearchHelp_az(ytext, xtext) {
671   
672
673    if (!xhidesearchhelp) {
674        if (xtext.length > 0) {
675            
676            if (typeof (objDataEncode) != 'undefined') {
677                objDataEncode.whiteList = /<[a-zA-Z!/?]/g;
678                if (objDataEncode.CheckDangerousString(objDataEncode.fieldType.Text, xtext)) {
679                    return false;
680                }
681                xtext = objDataEncode.FormDataHtmlEncode(objDataEncode.fieldType.Text, xtext);
682            }
683            
684            var ypageurl = 'v2/search/searchultra';
685            var compname = document.domain.replace("beta.", "").replace("www.", "").replace(".com", "")
686            var fabricui = 0
687            if (typeof (IsFabricUI) != 'undefined' && IsFabricUI) {
688                fabricui = 1
689            }
690            var sURL = "";
691            if (location.protocol === 'https:') {
692                sURL = "https://" + document.domain + "/" + ypageurl + "?compname=" + compname + "&text=" + xtext + "&fabricui=" + fabricui;
693            } else {
694                sURL = "http://" + document.domain + "/" + ypageurl + "?compname=" + compname + "&text=" + xtext + "&fabricui=" + fabricui;
695            }
696
697            jsXMLHTTP = null;
698
699            if (window.XMLHttpRequest) {
700                // code for Mozilla, etc.
701                jsXMLHTTP = new XMLHttpRequest()
702            } else if (window.ActiveXObject) {
703                // code for IE
704                jsXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");
705            }
706            if (jsXMLHTTP != null) {
707
708                //jsXMLHTTP.onreadystatechange = js_state_Change;
709                jsXMLHTTP.onload = function () {                    
710                        resp = jsXMLHTTP.responseText;                    
711                    if (resp.length > 0) {
712                        xResponse = true
713                        a_resp = resp.split('|#-#|')
714                        if (a_resp[0].length > 0) {
715                            a_words = a_resp[0].split('~')
716                            xCurrSelRow = 0
717                            xhelpctr++;
718                        }                        
719                        if (a_resp[1]) {
720                            if (a_resp[1].length > 0) {
721                                a_dept = a_resp[1].split('~')
722                            }
723                        }
724                        else {
725                            a_dept = "".split('~')
726                        }
727                    }
728                    else {
729                        xResponse = false
730                    }
731                    if (a_words.length > 0) {
732                        document.onkeyup = MoveCursor
733                        if (typeof (searchnewpopup) != 'undefined' && searchnewpopup == true) {
734                                PopulateSearchHelp_v2(a_words, ytext)                            
735                        }
736                        else if (typeof (searchnewpopupmobile) != 'undefined' && searchnewpopupmobile == true) {
737                            PopulateSearchHelpMobile(a_words, ytext)
738                        }                        
739                        else {
740                            PopulateSearchHelp(a_words, ytext)
741                        }
742                        xCurrSelRow = 1
743                        ShowImagesOnMouseOver(xCurrSelRow)
744                    }
745                }
746
747                jsXMLHTTP.open("GET", sURL, true);
748                jsXMLHTTP.send(null);
749
750            }
751
752            //ol_padxl = 0;
753            //ol_padxr = 0;
754            //ol_padyt = 0;
755            //ol_padyb = 0;
756            //o3_hauto = 1;
757
758            //ol_delay = 500;
759
760        }
761
762    }
763}
764function DisplaySearchHelp(ytext, xtext) {
765    if (!xhidesearchhelp) {
766        if (xtext.length > 0) {
767            resp = getPageFromServer('<%=server.htmlencode(SanitizeRequestQuery("CompName"))%>', '/xp/CallOutGetSearchesUltra.aspx', xtext)
768
769            if (resp.length > 0) {
770                xResponse = true
771                a_resp = resp.split('|#-#|')
772                if (a_resp[0].length > 0) {
773                    a_words = a_resp[0].split('~')
774                    xCurrSelRow = 0
775                    xhelpctr++;
776                }
777                if (a_resp[1]) {
778                    if (a_resp[1].length > 0) {
779                        a_dept = a_resp[1].split('~')
780                    }
781                }
782                else {
783                    a_dept = "".split('~')
784                }
785            }
786            else {
787                xResponse = false
788            }
789        }
790        if (a_words.length > 0) {
791            document.onkeyup = MoveCursor
792            PopulateSearchHelp(a_words, ytext)
793            xCurrSelRow = 1
794            ShowImagesOnMouseOver(xCurrSelRow)
795        }
796    }
797}
798var UpArrowClicked = false;
799var DownArrowClicked = false;
800
801function MoveCursor(e) {  
802    var keycode = 0;
803    if (!e) {
804        e = window.event;
805    }
806
807    if (e) {
808        if (e.keyCode) {
809            keycode = e.keyCode;
810        }
811        else {
812            keycode = e.keyCharcode;
813        }
814    }
815    if (keycode == 38 || UpArrowClicked) {  //Up
816        xForceApply = true
817        UpArrowClicked = false
818        if (xCurrSelRow > 1) {
819            xCurrSelRow--;
820        }
821        if (xCurrSelRow < xMaxSugg) {
822            $("#word" + (xCurrSelRow + 1)).removeClass("search-active")
823        }
824        $("#word" + xCurrSelRow).addClass("search-active")
825
826        if (searchobj.txtsearch) {
827            searchobj.txtsearch.focus();
828        }
829    }
830    else if (keycode == 40 || DownArrowClicked) {  //Down
831        xForceApply = true
832        DownArrowClicked = false
833        if (xCurrSelRow < xMaxSugg) {
834            xCurrSelRow++;
835        }
836        if (xCurrSelRow > 1) {
837            $("#word" + (xCurrSelRow - 1)).removeClass("search-active")
838        }
839        $("#word" + xCurrSelRow).addClass("search-active")
840
841        if (searchobj.txtsearch) {
842            searchobj.txtsearch.focus();
843        }
844    }
845    else if (xCurrSelRow > 0) {
846        for (var n = 1; n <= MaxKeywordSugg; n++) {
847            if (document.getElementById("word" + n)) {
848                $("#word" + n).removeClass("search-active")
849
850            }
851        }
852        if (document.getElementById("word" + xCurrSelRow)) {
853            $("#word" + xCurrSelRow).addClass("search-active")
854
855        }
856        if (searchobj.txtsearch) {
857            if (e && e.target != undefined && $(e.target).attr("name") != undefined && $(e.target).attr("name") == "txtsearch") {
858                searchobj.txtsearch.focus();
859            }
860        }
861    }
862    if (xCurrSelRow > 0 && xMaxSugg > 0) {
863        LastSelWord = a_words[a_ctridx[xCurrSelRow]]
864        var a_wordval = LastSelWord.split('^')
865        if (ShowImageSection && xCurrSelRow == 1) {
866            if (a_wordval[1].length > 0) {
867                m = 0;
868                if (a_wordval[1].indexOf(";") > 0) {                   
869                    var parts1 = a_wordval[1].split(";")
870                    var a_images = [];
871                    var a_link = [];
872
873                    parts1.forEach(function (part1) {
874                        if (part1.length > 0) {
875                            var parts2 = part1.split('$');
876                            if (parts2.length > 1) {
877                                var imgname = parts2[0];
878                                var imglink = parts2[1];
879                                a_images.push(imgname);
880                                a_link.push(imglink);
881                            } else {
882                                a_images.push(part1);
883                            }
884                        }
885                    });
886
887                    for (m = 0; m < a_images.length; m++) {
888                        if (m >= MaxProdImages) {
889                            break;
890                        }
891                        if (document.getElementById("SampleImage" + m)) {
892                            if (a_images[m].indexOf('/') < 0) { //this shold work for xpressmats deptartments
893                                document.getElementById("SampleImage" + m).src = "/img/dp/csd/" + a_images[m]
894                                document.getElementById("SampleImage" + m).style.cssText = "padding-left: 10px !important;padding-right: 10px !important;padding-top: 10px !important;padding-bottom: 10px !important;max-height: 72px !important;"
895                            } else {                               
896                                document.getElementById("SampleImage" + m).src = cdnPath + "/img/sm/" + a_images[m]
897                            }
898
899                        }
900                    }
901                }
902                else {
903                    if (document.getElementById("SampleImage0")) {
904                        if (a_wordval[1].indexOf('/') < 0) { //this shold work for xpressmats deptartments
905                            document.getElementById("SampleImage0").src = "/img/dp/csd/" + a_wordval[1]
906                        } else {
907
908                            document.getElementById("SampleImage0").src = cdnPath + "/img/sm/" + a_wordval[1]
909                        }
910                    }
911                }
912
913                for (n = m + 1; n < MaxProdImages; n++) {
914                    if (document.getElementById("SampleImage" + n)) {
915                        document.getElementById("SampleImage" + n).src = "/img/src/spacer.gif"
916                    }
917                }
918                if (document.getElementById("divSampleProduct")) {
919                    document.getElementById("divSampleProduct").innerHTML = a_wordval[0]   //"Quick Results for " +  
920                    document.getElementById("divSampleProduct").style.display = "block";
921                    document.getElementById("divSampleProduct").style.visibility = "visible";
922                }
923
924            }
925            else {
926                if (document.getElementById("SampleImage0")) {
927                    document.getElementById("SampleImage0").src = "/img/src/spacer.gif";
928                }
929                if (document.getElementById("divSampleProduct")) {
930                    document.getElementById("divSampleProduct").style.display = "none";
931                    document.getElementById("divSampleProduct").style.visibility = "hidden";
932                }
933            }
934        }
935    }
936    //37 left, 39 right
937}
938
939function GoUpDown(yclicktype) {
940    if (yclicktype == "UP") {
941        UpArrowClicked = true;
942        MoveCursor()
943    }
944    if (yclicktype == "DOWN") {
945        DownArrowClicked = true;
946        MoveCursor()
947    }
948}
949
950function ShowImagesOnMouseOver(rownum) {    
951    xCurrSelRow = rownum
952    MoveCursor()
953}
954function HideSearchHelpBox() {
955    if (typeof (searchnewpopupmobile) != 'undefined' && searchnewpopupmobile == true) {       
956        $("#searchCont_main").removeClass("hide");
957        document.getElementById("autoSuggest_container").style.display = "none";
958    } else {
959        document.getElementById(searchdiv).style.display = "none";
960    }
961   
962    var $btnclose = $(".header_mainSearch button.search_close");
963    if ($btnclose.length) {
964        $btnclose.click();
965    }
966    if (ShowImageSection) {
967        if (document.getElementById("divSampleProduct")) {
968            document.getElementById("divSampleProduct").style.display = "none";
969        }
970    }
971}
972function WipeCleanSearchHelpBox() {
973    document.getElementById(searchdiv).innerHTML = ""
974    document.getElementById(searchdiv).style.display = "none";
975
976}
977
978var jsXMLHTTP
979
980function getPageFromServer(ycompname, ypageurl, ytext) {
981
982    if (location.protocol === 'https:') {
983        var sURL = "https://" + document.domain + "/" + ypageurl + "?compname=" + document.domain + "&text=" + ytext;
984    } else {
985        var sURL = "http://" + document.domain + "/" + ypageurl + "?compname=" + document.domain + "&text=" + ytext;
986    }
987
988    jsXMLHTTP = null;
989
990    if (window.XMLHttpRequest) {
991        // code for Mozilla, etc.
992        jsXMLHTTP = new XMLHttpRequest()
993    } else if (window.ActiveXObject) {
994        // code for IE
995        jsXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");
996    }
997    if (jsXMLHTTP != null) {
998
999        jsXMLHTTP.onreadystatechange = js_state_Change;
1000        jsXMLHTTP.open("GET", sURL, false);
1001        jsXMLHTTP.send(null);
1002    } else {
1003    }
1004
1005    ol_padxl = 0;
1006    ol_padxr = 0;
1007    ol_padyt = 0;
1008    ol_padyb = 0;
1009    o3_hauto = 1;
1010
1011    ol_delay = 500;
1012    return jsXMLHTTP.responseText;
1013}
1014
1015function js_state_Change() {
1016    if (jsXMLHTTP.readyState == 4) {	// if xmlhttp shows "loaded"
1017        if (jsXMLHTTP.status == 200) {	// if "OK"
1018
1019        } else {
1020        }
1021    }
1022}
1023
1024var xForceApply = false
1025function ApplySearchHelp(ytext) {
1026    xForceApply = true
1027    if (searchobj.txtsearch && ytext.length > 0) {
1028        searchobj.txtsearch.value = ytext
1029    }
1030    if (validatesearch("")) {
1031        searchobj.submit()
1032    }
1033}
1034
1035function ApplyThisPhrase(ySearchString) {
1036    xForceApply = true
1037    if (document.preview.sfc) {
1038        if (document.preview.sfc.value.length > 0) {
1039            ClearAllFilters(0)
1040        }
1041    }
1042    document.productsearch.txtsearch.value = ySearchString
1043    if (validatesearch()) {
1044        document.productsearch.submit()
1045    }
1046}
1047
1048function ShowHighlighted() {
1049    document.getElementById(currsearchsection + "tableSampleImages").style.backgroundColor = "#FFFFCC";
1050    document.getElementById(currsearchsection + "tableSampleImages").style.cursor = "pointer"
1051}
1052
1053function HideHighlighted() {
1054    document.getElementById(currsearchsection + "tableSampleImages").style.backgroundColor = "#FFFFFF";
1055    document.getElementById(currsearchsection + "tableSampleImages").style.cursor = "auto"
1056}
1057
1058function PopulateSearchHelp(a_words, ytext) {
1059    
1060    var FullTableWidth = 250
1061    var newStylelist = false
1062    /*if (document.domain.toLowerCase().indexOf("myassettag") > 0) {*/
1063    if (typeof SearchImage !== 'undefined' && SearchImage == true ) {
1064        ShowImageSection = false
1065        $("#divsearchhelpbar").width("270px");
1066        $("#divsearchhelp").width("270px");         
1067    }
1068    if (ShowImageSection) {
1069        FullTableWidth = 655
1070    }
1071    if ($("#autoSuggest").length > 0) {
1072        newStylelist = true;
1073    }
1074
1075
1076
1077    var xstr = ""
1078    var xclass = ""
1079    var tctr = 0;
1080    var xctr = 0;
1081    var xcolctr = 0
1082    var xrowctr = 1
1083    var MaxCols = 1;
1084
1085    var xsampleimage = "spacer.gif" //"/img/src/spacer.gif" 
1086    var xspdisplay = "none"
1087    var xspvisibility = "hidden"
1088    var xapproxresults = "0";
1089    var xsamplesearch = "";
1090    var xlastgroupno = "";
1091
1092
1093    if (newStylelist) {
1094        var xtablestrNewStyle = ''
1095        searchdiv = "autoSuggest"
1096        for (var k = 0; k < a_words.length; k++) {
1097            var a_wordval = a_words[k].split('^')
1098            if (a_wordval[0].length > 0) {
1099                if (xResponse) {
1100                    xctr++;
1101                    a_ctridx[xctr] = k;
1102                    xMaxSugg = xctr;
1103
1104                    if (xctr == 1) {
1105                        if (a_wordval[1].length > 0) {
1106                            xsampleimage = a_wordval[1]
1107                            xapproxresults = a_wordval[2]
1108                            xsamplesearch = a_wordval[0]
1109                        }
1110                    }
1111
1112                    xcolctr++;
1113                    if (xctr > 18) {
1114                        break;
1115                    }
1116                    xclass = "atr0_bar_ultra"
1117                    xfloat = "left"
1118                    if (a_wordval[2] != xlastgroupno) {
1119                        if (a_wordval[2] == "1") {
1120                            xtablestrNewStyle = xtablestrNewStyle + '<span class="srch-head">Search Suggestions</span><ul class="mar-5">'
1121                        }
1122                        else if (a_wordval[2] == "2") {
1123                            xtablestrNewStyle = xtablestrNewStyle + '</ul><span class="srch-head">More Matches</span><ul class="mar-5">'
1124                        }
1125                        xlastgroupno = a_wordval[2]
1126                    }
1127                    xtablestrNewStyle = xtablestrNewStyle + '<li id=word' + xctr + ' class="pos-relative ripplelink" style=""><a class="iconTapText" onmouseover="javascript:ShowImagesOnMouseOver(' + (k + 1) + ')" href="javascript:ApplySearchHelp(\'' + a_wordval[0].split("'").join("\'") + '\')")>' + a_wordval[0] + '</a><span class="search_bend_arrow"><em class="icon icon-android-arrow-up"></em></span></li>'
1128
1129                }
1130            }
1131        }
1132        xtablestrNewStyle = xtablestrNewStyle + '</ul>'
1133        $("#autoSuggest").html(xtablestrNewStyle)
1134    }
1135    else {
1136        var searchbox_html = ""
1137        if (document.getElementById(searchdiv).style.display == "none") {
1138            document.getElementById(searchdiv).style.display = "block";
1139            document.getElementById(searchdiv).style.visibility = "visible";
1140            if (ShowImageSection) {
1141                if (document.getElementById("divSampleProduct")) {
1142                    document.getElementById("divSampleProduct").style.display = "none";
1143                    document.getElementById("divSampleProduct").style.visibility = "hidden";
1144                }
1145            }
1146        }
1147        document.getElementById(searchdiv).style.width = FullTableWidth * MaxCols;
1148        if (document.domain.toLowerCase().indexOf("myparkingsign") > 0 || document.domain.toLowerCase().indexOf("myparkingpermit") > 0 || document.domain.toLowerCase().indexOf("mysafetysign") > 0 || document.domain.toLowerCase().indexOf("mysecuritysign") > 0 || document.domain.toLowerCase().indexOf("mydoorsign") > 0 || document.domain.toLowerCase().indexOf("xpresstags") > 0 || document.domain.toLowerCase().indexOf("mysafetylabels") > 0 || document.domain.toLowerCase().indexOf("xpressmats") > 0 || document.domain.toLowerCase().indexOf("myhardhatstickers") > 0 || document.domain.toLowerCase().indexOf("roadtrafficsigns") > 0 || document.domain.toLowerCase().indexOf("qclabels") > 0 || document.domain.toLowerCase().indexOf("mynamebadges") > 0 || document.domain.toLowerCase().indexOf("swimmingpoolsigns") > 0 || document.domain.toLowerCase().indexOf("labellab") > 0 || document.domain.toLowerCase().indexOf("mynameplates") > 0 || document.domain.toLowerCase().indexOf("campgroundsigns") > 0 || document.domain.toLowerCase().indexOf("xpresstabs") > 0 || document.domain.toLowerCase().indexOf("dogpoopsigns") > 0 || document.domain.toLowerCase().indexOf("lockouttag") > 0 || document.domain.toLowerCase().indexOf("recyclereminders") > 0 || document.domain.toLowerCase().indexOf("xpressstamp") > 0 || document.domain.toLowerCase().indexOf("tamperevidentlabels") > 0 || document.domain.toLowerCase().indexOf("photo-badge") > 0) {
1149            searchbox_html = searchbox_html + '<div class="searchcloseBtn">
1149<a onclick="HideSearchHelpBox()" id="CloseBtn"></a></div>'
1150        }
1151        searchbox_html = searchbox_html + '<div class="row gx-3 search_resultMain">'
1152        searchbox_html = searchbox_html + '<div class="col-md-4 col-lg-3 searchList_col">'
1153        searchbox_html = searchbox_html + '<div class="search_suggestion">'
1154        searchbox_html = searchbox_html + '<div class="search_title">Suggestion</div>'
1155        searchbox_html = searchbox_html + '<ul class="list-unstyled search-list">'
1156        for (var k = 0; k < a_words.length; k++) {
1157            var a_wordval = a_words[k].split('^')
1158            if (a_wordval[0].length > 0) {
1159                if (xResponse) {
1160                    xctr++;
1161                    a_ctridx[xctr] = k;
1162                    xMaxSugg = xctr;
1163
1164                    if (xctr == 1) {
1165                        if (a_wordval[1].length > 0) {
1166                            xsampleimage = a_wordval[1]
1167                            xspdisplay = "block"
1168                            xspvisibility = "visible"
1169                            xapproxresults = a_wordval[2]
1170                            xsamplesearch = a_wordval[0]
1171                        }
1172                    }
1173
1174                    xcolctr++;
1175                    if (xctr > 18) {
1176                        break;
1177                    }
1178                    if (xcolctr == MaxCols + 1) {
1179                        xstr = xstr + '<br>'
1180
1181                        xcolctr = 1;
1182                        xrowctr++;
1183                    }
1184                    xclass = "atr0_bar_ultra"
1185                    xfloat = "left"
1186
1187                    //IEBrowser
1188                    if (1 == 1) {
1189                        if (a_wordval[2] != xlastgroupno) {
1190                            if (a_wordval[2] == "1") {
1191
1192                            }
1193                            else if (a_wordval[2] == "2") {
1194                                searchbox_html = searchbox_html + '</ul>'
1195                                searchbox_html = searchbox_html + '<div style="margin-top:5px;" class="search_title">More Matches</div>'
1196                                searchbox_html = searchbox_html + '<ul class="list-unstyled search-list">'
1197
1198                            }
1199                            xlastgroupno = a_wordval[2]
1200                        }
1201
1202                        searchbox_html = searchbox_html + '<li id=word' + xctr + '><a onmouseover="javascript:ShowImagesOnMouseOver(' + (k + 1) + ')"  href="javascript:ApplySearchHelp(\'' + a_wordval[0].split("'").join("\'") + '\')")>' + a_wordval[0] + '</a></li>'
1203                    }
1204
1205
1206                }
1207            }
1208        }
1209        searchbox_html = searchbox_html + '</ul>'
1210        searchbox_html = searchbox_html + '</div>'
1211        searchbox_html = searchbox_html + '</div>'
1212
1213        if (ShowImageSection) {
1214            
1215            searchbox_html = searchbox_html + '<div class="col-md-8 col-lg-9 searchProduct_col" id="divSampleImages" onclick="ApplySearchHelp(\'' + '\')" >'
1216            var ximageHTML = '<div class="searchProduct_grid row" id="' + currsearchsection + 'tableSampleImages" >'
1217            var parts1 = xsampleimage.split(";")
1218            var a_images = [];
1219            var a_link = [];
1220
1221            parts1.forEach(function (part1) {
1222                if (part1.length > 0) {
1223                    var parts2 = part1.split('$');
1224                    if (parts2.length > 1) {
1225                        var imgname = parts2[0];
1226                        var imglink = parts2[1];
1227                        a_images.push(imgname);
1228                        a_link.push(imglink);
1229                    } else {
1230                        a_images.push(part1);
1231                    }
1232                }
1233            });
1234
1235            for (var k = 0; k < a_images.length; k++) {
1236                if (k >= MaxProdImages) {
1237                    break;
1238                }
1239                ximageHTML = ximageHTML + '<div class="col-md-2 col-lg-2 searchProduct_item">'
1240                ximageHTML = ximageHTML + '<div class="card border-0">'
1241                ximageHTML = ximageHTML + '<div class="card-body" style="padding:0px">'
1242                if (a_link.length > 0) {
1243                    ximageHTML = ximageHTML + '<a href="' + a_link[k] + '">'
1244                } else {
1245                    ximageHTML = ximageHTML + '<a href="javascript:void(0);">'
1246                }
1247                
1248
1249                ximageHTML = ximageHTML + '<div class="card-img-inner">'
1250                if (document.domain.toLowerCase().indexOf("xpressmats") > 0 && a_images[k].indexOf('/') < 0) {                  
1251                        ximageHTML = ximageHTML + '<img id="SampleImage' + k + '" src="/img/dp/csd/' + a_images[k] + '" alt="" class="img-fluid" >'                    
1252
1253                } else {                    
1254                        ximageHTML = ximageHTML + '<img id="SampleImage' + k + '" src="/img/sm/' + a_images[k] + '" alt="" class="img-fluid" >'                    
1255                }
1256                ximageHTML = ximageHTML + '</div>'
1257                ximageHTML = ximageHTML + '</a>'
1258                ximageHTML = ximageHTML + '</div>'
1259                ximageHTML = ximageHTML + '</div>'
1260                ximageHTML = ximageHTML + '</div>'
1261            }
1262            ximageHTML = ximageHTML + "<div class='col-md-12 col-lg-12' style='text-align: right;padding-top:10px;font-size:14px;'><a href='/search/" + trimstr(searchobj.txtsearch.value) + "' class='search_btn_text btn btn-sm btn-primary'><b>View all results ></b></a></div>";
1263            ximageHTML = ximageHTML + '</div>'
1264            searchbox_html = searchbox_html + ximageHTML
1265            if (a_dept.length > 0) {
1266                if (a_dept[0].indexOf('^') >= 0) {
1267
1268
1269                    searchbox_html = searchbox_html + '<div class="searchProduct_grid row" id="' + currsearchsection + 'tableDept" >'
1270                    searchbox_html = searchbox_html + '<div class="col-md-12 col-lg-12 search_title">Relevant Department Matches-</div>'
1271                    for (k = 0; k < a_dept.length; k++) {
1272                        if (k >= MaxDept) {
1273                            break;
1274                        }
1275                        if (a_dept[k].indexOf('^') >= 0) {
1276
1277                            var a_currdept = a_dept[k].split("^")
1278
1279                            searchbox_html = searchbox_html + '<div class="col-md-3 col-lg-3 searchProduct_item">'
1280                            searchbox_html = searchbox_html + '<div class="card border-0">'
1281                            searchbox_html = searchbox_html + '<div class="card-body" style="padding:0px">'
1282                            searchbox_html = searchbox_html + '<a href="/' + a_currdept[2] + '">'
1283                            searchbox_html = searchbox_html + '<div class="card-img-inner">'
1284                            searchbox_html = searchbox_html + '<img id="DeptImage' + k + '" src="' + a_currdept[0] + '" alt="" class="img-fluid" >'
1285                            searchbox_html = searchbox_html + '</div>'
1286                            searchbox_html = searchbox_html + '<div class="card-title">' + a_currdept[1] + '</div>'
1287                            searchbox_html = searchbox_html + '</a>'
1288                            searchbox_html = searchbox_html + '</div>'
1289                            searchbox_html = searchbox_html + '</div>'
1290                            searchbox_html = searchbox_html + '</div>'
1291                        }
1292                    }
1293
1294
1295                   
1296                    searchbox_html = searchbox_html + '</div>'
1297
1298                }
1299            }
1300            
1301            searchbox_html = searchbox_html + '</div>'
1302
1303
1304
1305        }
1306
1307
1308
1309
1310        document.getElementById(searchdiv).innerHTML = searchbox_html;
1311
1312        document.getElementById(searchdiv).style.left = document.getElementById(searchcontainer).style.left
1313        document.getElementById(searchdiv).style.top = document.getElementById(searchcontainer).style.top
1314
1315
1316
1317        if (xctr > 0 && ytext.length > 0) {
1318            document.getElementById(searchdiv).style.display = "block";
1319            document.getElementById(searchdiv).style.visibility = "visible";
1320        }
1321        else {
1322            document.getElementById(searchdiv).style.display = "none";
1323            document.getElementById(searchdiv).style.visibility = "hidden";
1324        }
1325        if (document.getElementById("divSampleProduct")) {
1326            document.getElementById("divSampleProduct").innerHTML = "Quick Results for " + ytext
1327        }
1328        
1329        searchbox_html = searchbox_html + "</div>"
1330    }
1331
1332}
1333
1334function PopulateSearchHelp_v2(a_words, ytext) {
1335
1336    var FullTableWidth = 250
1337    var newStylelist = false
1338    /*if (document.domain.toLowerCase().indexOf("myassettag") > 0) {*/
1339    if (typeof SearchImage !== 'undefined' && SearchImage == true) {
1340        ShowImageSection = false
1341        $("#divsearchhelpbar").width("270px");
1342        $("#divsearchhelp").width("270px");
1343    }
1344    if (ShowImageSection) {
1345        FullTableWidth = 655
1346    }
1347    if ($("#autoSuggest").length > 0) {
1348        newStylelist = true;
1349    }
1350
1351
1352
1353    var xstr = ""
1354    var xclass = ""
1355    var tctr = 0;
1356    var xctr = 0;
1357    var xcolctr = 0
1358    var xrowctr = 1
1359    var MaxCols = 1;
1360
1361    var xsampleimage = "spacer.gif" //"/img/src/spacer.gif" 
1362    var xspdisplay = "none"
1363    var xspvisibility = "hidden"
1364    var xapproxresults = "0";
1365    var xsamplesearch = "";
1366    var xlastgroupno = "";
1367    var MaxDept = 5
1368
1369    if (newStylelist) {
1370        var xtablestrNewStyle = ''
1371        searchdiv = "autoSuggest"
1372        for (var k = 0; k < a_words.length; k++) {
1373            var a_wordval = a_words[k].split('^')
1374            if (a_wordval[0].length > 0) {
1375                if (xResponse) {
1376                    xctr++;
1377                    a_ctridx[xctr] = k;
1378                    xMaxSugg = xctr;
1379
1380                    if (xctr == 1) {
1381                        if (a_wordval[1].length > 0) {
1382                            xsampleimage = a_wordval[1]
1383                            xapproxresults = a_wordval[2]
1384                            xsamplesearch = a_wordval[0]
1385                        }
1386                    }
1387
1388                    xcolctr++;
1389                    if (xctr > 18) {
1390                        break;
1391                    }
1392                    xclass = "atr0_bar_ultra"
1393                    xfloat = "left"
1394                    if (a_wordval[2] != xlastgroupno) {
1395                        if (a_wordval[2] == "1") {
1396                            xtablestrNewStyle = xtablestrNewStyle + '<span class="srch-head">Search Suggestions</span><ul class="mar-5">'
1397                        }
1398                        else if (a_wordval[2] == "2") {
1399                            xtablestrNewStyle = xtablestrNewStyle + '</ul><span class="srch-head">More Matches</span><ul class="mar-5">'
1400                        }
1401                        xlastgroupno = a_wordval[2]
1402                    }
1403                    xtablestrNewStyle = xtablestrNewStyle + '<li id=word' + xctr + ' class="pos-relative ripplelink" style=""><a class="iconTapText" onmouseover="javascript:ShowImagesOnMouseOver(' + (k + 1) + ')" href="javascript:ApplySearchHelp(\'' + a_wordval[0].split("'").join("\'") + '\')")>' + a_wordval[0] + '</a><span class="search_bend_arrow"><em class="icon icon-android-arrow-up"></em></span></li>'
1404
1405                }
1406            }
1407        }
1408        xtablestrNewStyle = xtablestrNewStyle + '</ul>'
1409        $("#autoSuggest").html(xtablestrNewStyle)
1410    }
1411    else {
1412        var searchbox_html = ""
1413        if (document.getElementById(searchdiv).style.display == "none") {
1414            document.getElementById(searchdiv).style.display = "block";
1415            document.getElementById(searchdiv).style.visibility = "visible";
1416            if (ShowImageSection) {
1417                if (document.getElementById("divSampleProduct")) {
1418                    document.getElementById("divSampleProduct").style.display = "none";
1419                    document.getElementById("divSampleProduct").style.visibility = "hidden";
1420                }
1421            }
1422        }
1423        document.getElementById(searchdiv).style.width = FullTableWidth * MaxCols;
1424        if (document.domain.toLowerCase().indexOf("myparkingsign") > 0 || document.domain.toLowerCase().indexOf("myparkingpermit") > 0 || document.domain.toLowerCase().indexOf("mysafetysign") > 0 || document.domain.toLowerCase().indexOf("mysecuritysign") > 0 || document.domain.toLowerCase().indexOf("mydoorsign") > 0 || document.domain.toLowerCase().indexOf("xpresstags") > 0 || document.domain.toLowerCase().indexOf("mysafetylabels") > 0 || document.domain.toLowerCase().indexOf("xpressmats") > 0 || document.domain.toLowerCase().indexOf("myhardhatstickers") > 0 || document.domain.toLowerCase().indexOf("roadtrafficsigns") > 0 || document.domain.toLowerCase().indexOf("qclabels") > 0 || document.domain.toLowerCase().indexOf("mynamebadges") > 0 || document.domain.toLowerCase().indexOf("swimmingpoolsigns") > 0 || document.domain.toLowerCase().indexOf("labellab") > 0 || document.domain.toLowerCase().indexOf("mynameplates") > 0 || document.domain.toLowerCase().indexOf("campgroundsigns") > 0 || document.domain.toLowerCase().indexOf("xpresstabs") > 0 || document.domain.toLowerCase().indexOf("dogpoopsigns") > 0 || document.domain.toLowerCase().indexOf("lockouttag") > 0 || document.domain.toLowerCase().indexOf("recyclereminders") > 0 || document.domain.toLowerCase().indexOf("xpressstamp") > 0 || document.domain.toLowerCase().indexOf("tamperevidentlabels") > 0 || document.domain.toLowerCase().indexOf("photo-badge") > 0) {
1425            // searchbox_html = searchbox_html + '<div class="searchcloseBtn">
1425<a onclick="HideSearchHelpBox()" id="CloseBtn"></a></div>'
1426        }
1427        searchbox_html = searchbox_html + '<div class="search_result_box">'
1428        searchbox_html = searchbox_html + '<div class="search_list_col">'
1429        searchbox_html = searchbox_html + '<div class="search_list_panel">'
1430        searchbox_html = searchbox_html + '<div class="search_panel_heading">Suggestions</div>'
1431        searchbox_html = searchbox_html + '<ul class="list-unstyled">'
1432        for (var k = 0; k < a_words.length; k++) {
1433            var a_wordval = a_words[k].split('^')
1434            if (a_wordval[0].length > 0) {
1435                if (xResponse) {
1436                    xctr++;
1437                    a_ctridx[xctr] = k;
1438                    xMaxSugg = xctr;
1439
1440                    if (xctr == 1) {
1441                        if (a_wordval[1].length > 0) {
1442                            xsampleimage = a_wordval[1]
1443                            xspdisplay = "block"
1444                            xspvisibility = "visible"
1445                            xapproxresults = a_wordval[2]
1446                            xsamplesearch = a_wordval[0]
1447                        }
1448                    }
1449
1450                    xcolctr++;
1451                    if (xctr > 18) {
1452                        break;
1453                    }
1454                    if (xcolctr == MaxCols + 1) {
1455                        xstr = xstr + '<br>'
1456
1457                        xcolctr = 1;
1458                        xrowctr++;
1459                    }
1460                    xclass = "atr0_bar_ultra"
1461                    xfloat = "left"
1462
1463                    //IEBrowser
1464                    if (1 == 1) {
1465                        if (a_wordval[2] != xlastgroupno) {
1466                            if (a_wordval[2] == "1") {
1467
1468                            }
1469                            else if (a_wordval[2] == "2") {
1470                                searchbox_html = searchbox_html + '</ul>'
1471                                searchbox_html = searchbox_html + '<div class="search_panel_heading">More Matches</div>'
1472                                searchbox_html = searchbox_html + '<ul class="list-unstyled">'
1473
1474                            }
1475                            xlastgroupno = a_wordval[2]
1476                        }
1477
1478                        searchbox_html = searchbox_html + '<li  id=word' + xctr + '><a class="search_list_link" onmouseover="javascript:ShowImagesOnMouseOver(' + (k + 1) + ')"  href="javascript:ApplySearchHelp(\'' + a_wordval[0].split("'").join("\'") + '\')")>' + a_wordval[0] + '</a></li>'
1479                    }
1480
1481
1482                }
1483            }
1484        }
1485        searchbox_html = searchbox_html + '</ul>'
1486        searchbox_html = searchbox_html + '</div>'
1487        searchbox_html = searchbox_html + '</div>'
1488
1489
1490        if (ShowImageSection) {
1491                        
1492
1493            searchbox_html = searchbox_html + '<div class="search_product_col" id="divSampleImages" onclick="ApplySearchHelp(\'' + '\')" >'
1494            var ximageHTML = '<div class="search_panel_heading">Product Suggestions</div>'
1495            ximageHTML = ximageHTML + '<div class="search_product_grid" id="' + currsearchsection + 'tableSampleImages" >'
1496            var parts1 = xsampleimage.split(";")
1497            var a_images = [];
1498            var a_link = [];
1499            var a_desc = [];
1500
1501            parts1.forEach(function (part1) {
1502                if (part1.length > 0) {
1503                    var parts2 = part1.split('$');
1504                    if (parts2.length > 1) {
1505                        var imgname = parts2[0];
1506                        var imglink = parts2[1].split('#')[0];
1507                        a_images.push(imgname);
1508                        a_link.push(imglink);
1509                        a_desc.push(parts2[1].split('#')[1]);
1510                    } else {
1511                        a_images.push(part1);
1512                    }
1513                }
1514            });
1515
1516            for (var k = 0; k < a_images.length; k++) {
1517                if (k >= MaxProdImages) {
1518                    break;
1519                }
1520                ximageHTML = ximageHTML + '<div class="search_product_grid_item">'
1521
1522                ximageHTML = ximageHTML + '<div class="search_panal_product">'              
1523                if (a_link.length > 0) {
1524                    ximageHTML = ximageHTML + "<a title='" + a_desc[k] + "' href='" + a_link[k] + "'>"
1525                } else {
1526                    ximageHTML = ximageHTML + '<a href="javascript:void(0);">'
1527                }
1528
1529
1530                ximageHTML = ximageHTML + '<div class="search_panal_product_img">'
1531                if (document.domain.toLowerCase().indexOf("xpressmats") > 0 && a_images[k].indexOf('/') < 0) {
1532                    ximageHTML = ximageHTML + '<img id="SampleImage' + k + '" src="' + cdnPath + '/img/dp/csd/' + a_images[k] + '" alt="" class="img-fluid" >'
1533
1534                } else {
1535                    ximageHTML = ximageHTML + '<img id="SampleImage' + k + '" src="' + cdnPath + '/img/sm/' + a_images[k] + '" alt="" class="img-fluid" >'
1536                }
1537                ximageHTML = ximageHTML + '</div>'
1538                if (a_desc[k] !== undefined) {
1539                    ximageHTML = ximageHTML + '<div class="search_panal_product_title"> ' + a_desc[k] + ' </div>';
1540                    }
1541                ximageHTML = ximageHTML + '</a>'               
1542                ximageHTML = ximageHTML + '</div>'
1543
1544                ximageHTML = ximageHTML + '</div>'
1545           }
1546
1547            ximageHTML = ximageHTML + '</div>'
1548         
1549            ximageHTML = ximageHTML + "<div class='text-right text-end mt-2 view_all_results_box'><a href='/search/" + trimstr(searchobj.txtsearch.value) + "' class='search_btn_text btn btn-sm btn-primary'><b>View all results ></b></a></div>";
1550            
1551            searchbox_html = searchbox_html + ximageHTML
1552            if (a_dept.length > 0) {
1553                if (a_dept[0].indexOf('^') >= 0) {
1554
1555                    searchbox_html = searchbox_html + "<div class='search_panel_heading'>Relevant Department Matches</div>"
1556                    searchbox_html = searchbox_html + '<div class="search_product_grid relevant_department_grid" id="' + currsearchsection + 'tableDept" >'
1557                    for (k = 0; k < a_dept.length; k++) {
1558                        if (k >= MaxDept) {
1559                            break;
1560                        }
1561                        if (a_dept[k].indexOf('^') >= 0) {
1562
1563                            var a_currdept = a_dept[k].split("^")
1564
1565                            searchbox_html = searchbox_html + '<div class="search_product_grid_item">'
1566                            searchbox_html = searchbox_html + '<div class="search_panal_product">'                         
1567                            searchbox_html = searchbox_html + "<a title='" + a_currdept[1] + "' href='/" + a_currdept[2] + "'>"
1568                            searchbox_html = searchbox_html + '<div class="search_panal_product_img"  >'
1569                            searchbox_html = searchbox_html + '<img id="DeptImage' + k + '" src="' + a_currdept[0] + '" alt="" class="img-fluid" >'
1570                            searchbox_html = searchbox_html + '</div>'
1571                            searchbox_html = searchbox_html + '<div class="search_panal_product_title">' + a_currdept[1] + '</div>'
1572                            searchbox_html = searchbox_html + '</a>'                            
1573                            searchbox_html = searchbox_html + '</div>'
1574                            searchbox_html = searchbox_html + '</div>'
1575                        }
1576                    }
1577
1578
1579                    searchbox_html = searchbox_html + '</div>'
1580
1581                }
1582            }
1583
1584            searchbox_html = searchbox_html + '</div>'
1585
1586
1587
1588        }
1589
1590        searchbox_html = searchbox_html + '</div>'
1591        searchbox_html = searchbox_html + '</div>'
1592
1593        if (typeof (searchnewpopup) != 'undefined' && searchnewpopup == true)
1594        {
1595            if ($("#search_box").val().trim() == '') {
1596                document.getElementById(searchdiv).innerHTML = "";
1597            } else {
1598                document.getElementById(searchdiv).innerHTML = searchbox_html;
1599            }
1600        }
1601        else
1602        {
1603            document.getElementById(searchdiv).innerHTML = searchbox_html;
1604        }
1605       
1606        //if (document.getElementById(searchcontainer) != null)
1607        //{
1608            document.getElementById(searchdiv).style.left = document.getElementById(searchcontainer).style.left
1609            document.getElementById(searchdiv).style.top = document.getElementById(searchcontainer).style.top
1610        //}
1611
1612
1613        if (xctr > 0 && ytext.length > 0) {
1614            document.getElementById(searchdiv).style.display = "block";
1615            document.getElementById(searchdiv).style.visibility = "visible";          
1616        }
1617        else {
1618            document.getElementById(searchdiv).style.display = "none";
1619            document.getElementById(searchdiv).style.visibility = "hidden";
1620        }
1621        if (document.getElementById("divSampleProduct")) {
1622            document.getElementById("divSampleProduct").innerHTML = "Quick Results for " + ytext
1623        }
1624
1625        searchbox_html = searchbox_html + "</div>"
1626    }
1627
1628}
1629try {
1630    $("body").on("click", "#txtsearch_wrpr", function () {
1631        // document.getElementById(searchdiv).style.display = "none";
1632        // document.getElementById(searchdiv).style.visibility = "hidden";
1633        $("#txtsearch").attr("type", "search")
1634        document.productsearch.action = "#"
1635    });
1636    $(document).ready(function () {
1637        var $searchbox = $("#search_box")
1638        var $hdntxtsearch = $("form[name='preview']").find("[name='txtsearch']")
1639        if ($hdntxtsearch.length && $searchbox.length) {
1640            $searchbox.val($hdntxtsearch.val())
1641        }
1642
1643    })
1644} catch (ex) {
1645
1646}
1647
1648var MaxProdImages = 18
1649var MaxKeywordSugg = 20
1650var xhelpctr = 0
1651var xhelpusedpercent = 100
1652var MaxDept = 4
1653
1654function getSampleImageHTML(ximages) {
1655   
1656    var ximageHTML
1657    var a_images = ximages.split(";")
1658    var k, j
1659    ximageHTML = ""
1660    for (k = 0; k < a_images.length; k++) {
1661        if (k >= MaxProdImages) {
1662            break;
1663        }
1664        if (k % 3 == 0 && k > 0) {
1665            ximageHTML = ximageHTML + "</tr>"
1666            ximageHTML = ximageHTML + "<tr>"
1667        }
1668        if (document.domain.toLowerCase().indexOf("xpressmats") > 0 && a_images[k].indexOf('/') < 0) {           
1669                ximageHTML = ximageHTML + '<td width="72" height="72" style="border-width:1px; border-style:solid; border-color:#EAEAEA;" align="center"><img style="padding-left:10px; padding-right:10px; padding-top:10px; padding-bottom:10px;max-width:72px" id="SampleImage' + k + '" src="/img/dp/csd/' + a_images[k] + '" border="0"></td>'            
1670        } else {           
1671                ximageHTML = ximageHTML + '<td width="72" height="72" style="border-width:1px; border-style:solid; border-color:#EAEAEA;" align="center"><img style="padding-left:10px; padding-right:10px; padding-top:10px; padding-bottom:10px;" id="SampleImage' + k + '" src="/img/sm/' + a_images[k] + '" border="0"></td>'            
1672        }
1673
1674    }
1675
1676    if (k < MaxProdImages) {
1677        for (j = k; j < MaxProdImages; j++) {
1678            if (j % 3 == 0 && j > 0) {
1679                ximageHTML = ximageHTML + "</tr>"
1680                ximageHTML = ximageHTML + "<tr>"
1681            }
1682            ximageHTML = ximageHTML + '<td width="72" height="72" style="border-width:1px; border-style:solid; border-color:#EAEAEA;" align="center"><img style="padding-left:10px; padding-right:10px; padding-top:10px; padding-bottom:10px;" id="SampleImage' + j + '" src="/img/src/spacer.gif" border="0"></td>'
1683        }
1684    }
1685    return ximageHTML;
1686}
1687
1688function getDeptHTML() {
1689    var xDeptHTML = ""
1690    var k, j
1691    if (a_dept.length >= 0) {
1692
1693        for (k = 0; k < a_dept.length; k++) {
1694            if (k >= MaxDept) {
1695                break;
1696            }
1697            if (a_dept[k].indexOf('^') >= 0) {
1698                if (k == 0) {
1699                    xDeptHTML = '<tr>
1699<td width="400" colspan="3" align="left" valign="middle" height=28 class="body10b_ultra" style="padding-left:2px;">Relevant Department Matches-</td></tr><tr>'
1700                }
1701                var a_currdept = a_dept[k].split("^")
1702                if (k % 3 == 0 && k > 0) {
1703                    xDeptHTML = xDeptHTML + "</tr>"
1704                    xDeptHTML = xDeptHTML + "<tr>"
1705                }
1706                xDeptHTML = xDeptHTML + '   <td width="200" height="125" style="border-width:1px; border-style:solid; border-color:#EAEAEA;" align="center" valign="top">'
1707                xDeptHTML = xDeptHTML + '       <div class="body8b_ultra"><a href="/' + a_currdept[2] + '" rel="nofollow">' + a_currdept[1] + '</a></div>'
1708                xDeptHTML = xDeptHTML + '       <div><a href="/' + a_currdept[2] + '" rel="nofollow"><img border="0" style="padding-left:2px; padding-right:2px; padding-top:4px; padding-bottom:2px; max-width:150px; max-height:113px;" id="DeptImage' + k + '" src="' + a_currdept[0] + '" border="0" ></a></div>'
1709                xDeptHTML = xDeptHTML + '   </td>'
1710            }
1711        }
1712    }
1713    else {
1714        xDeptHTML = xDeptHTML + '   <tr><td width="200" height="200" style="border-width:1px; border-style:solid; border-color:#EAEAEA;" align="center" valign="top"></td>'
1715    }
1716    return xDeptHTML;
1717
1718}
1719var searchobj;
1720var searchdiv;
1721var searchcontainer;
1722var currsearchsection = "";
1723
1724
1725function trimstrbar(ystr) {
1726    var xfound = false
1727    if (ystr.length == 0) return ""
1728    for (var k = 0; k < ystr.length; k++) {
1729        if (!xfound) {
1730            if (ystr.charAt(k) == " ") {
1731            }
1732            else {
1733                ystr = ystr.substring(k, ystr.length)
1734                xfound = true
1735                break
1736            }
1737        }
1738    }
1739    if (!xfound) ystr = ""
1740
1741    xfound = false
1742    if (ystr.length == 0) return ""
1743    for (k = ystr.length - 1; k >= 0; k--) {
1744        if (!xfound) {
1745            if (ystr.charAt(k) == " ") {
1746            }
1747            else {
1748                ystr = ystr.substring(0, k + 1)
1749                xfound = true
1750                break
1751            }
1752        }
1753    }
1754    if (!xfound) ystr = ""
1755    return ystr
1756}
1757
1758function htmlDecode(value) {
1759    return $('<div/>').html(value).text();
1760}
1761function jsHtmlEncode(val) {
1762    var NOT_SAFE_IN_XML_1_0 = /[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm;
1763    // return htmlDecode(val.replace(NOT_SAFE_IN_XML_1_0, '').replace(/</g, "&lt;").replace(/>/g, "&gt;")).replace(/</g, "&lt;").replace(/&#/g, "& #").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/\//g ,"&#x2F;")
1764
1765    return htmlDecode(val.replace(NOT_SAFE_IN_XML_1_0, '').replace(/</g, "&lt;").replace(/>/g, "&gt;")).replace(/</g, "&lt;").replace(/&#/g, "& #").replace(/>/g, "&gt;")
1766}
1767
1768function PopulateSearchHelpMobile(a_words, ytext) {
1769    var xstr = ""
1770    var xclass = ""
1771    var tctr = 0;
1772    var xctr = 0;
1773    var xcolctr = 0
1774    var xrowctr = 1
1775    var MaxCols = 1;
1776
1777    var xsampleimage = "spacer.gif" //"/img/src/spacer.gif" 
1778    var xspdisplay = "none"
1779    var xspvisibility = "hidden"
1780    var xapproxresults = "0";
1781    var xsamplesearch = "";
1782    var xlastgroupno = "";
1783    var MaxDept = 5
1784
1785
1786    var searchbox_html = ""
1787
1788
1789    searchbox_html = searchbox_html + '<div id="autoSuggest hide">'
1790    searchbox_html = searchbox_html + '<span class="srch-head">Suggestion</span>'
1791    searchbox_html = searchbox_html + '<ul class="srch_ul_suggestion_links">'
1792    for (var k = 0; k < a_words.length; k++) {
1793        var a_wordval = a_words[k].split('^')
1794        if (a_wordval[0].length > 0) {
1795            if (xResponse) {
1796                xctr++;
1797                if (xctr == 1) {
1798                    if (a_wordval[1].length > 0) {
1799                        xsampleimage = a_wordval[1]
1800                        xspdisplay = "block"
1801                        xspvisibility = "visible"
1802                        xapproxresults = a_wordval[2]
1803                        xsamplesearch = a_wordval[0]
1804                    }
1805                }
1806
1807                if (a_wordval[2] == "1") {
1808                    searchbox_html = searchbox_html + '<li class="pos-relative ripplelink"  id=word' + xctr + '><a class="search_list_link"  href="javascript:ApplySearchHelp(\'' + a_wordval[0].split("'").join("\'") + '\')")>' + a_wordval[0] + '</a></li>'
1809                }
1810            }
1811        }
1812    }
1813    searchbox_html = searchbox_html + '</ul>'
1814    searchbox_html = searchbox_html + '<hr class="separator_full">'
1815    var ximageHTML = '<span class="srch-head">Product Suggestions</span>'
1816    ximageHTML = ximageHTML + '<div class="search_product_grid">'
1817    var parts1 = xsampleimage.split(";")
1818    var a_images = [];
1819    var a_link = [];
1820    var a_desc = [];
1821
1822    parts1.forEach(function (part1) {
1823        if (part1.length > 0) {
1824            var parts2 = part1.split('$');
1825            if (parts2.length > 1) {
1826                var imgname = parts2[0];
1827                var imglink = parts2[1].split('#')[0];
1828                a_images.push(imgname);
1829                a_link.push(imglink);
1830                a_desc.push(parts2[1].split('#')[1]);
1831            } else {
1832                a_images.push(part1);
1833            }
1834        }
1835    });
1836
1837    for (var k = 0; k < a_images.length; k++) {
1838        if (k >= MaxProdImages) {
1839            break;
1840        }
1841        ximageHTML = ximageHTML + '<div class="search_product_grid_item">'
1842
1843        ximageHTML = ximageHTML + '<div class="search_panal_product">'
1844        if (a_link.length > 0) {
1845            ximageHTML = ximageHTML + "<a title='" + a_desc[k] + "' href='" + a_link[k] + "'>"
1846        } else {
1847            ximageHTML = ximageHTML + '<a href="javascript:void(0);">'
1848        }
1849
1850
1851        ximageHTML = ximageHTML + '<div class="search_panal_product_img">'
1852        if (document.domain.toLowerCase().indexOf("xpressmats") > 0 && a_images[k].indexOf('/') < 0) {
1853            ximageHTML = ximageHTML + '<img id="SampleImage' + k + '" src="' + cdnPath + '/img/dp/csd/' + a_images[k] + '" alt="" class="img-fluid" >'
1854
1855        } else {
1856            ximageHTML = ximageHTML + '<img id="SampleImage' + k + '" src="' + cdnPath + '/img/sm/' + a_images[k] + '" alt="" class="img-fluid" >'
1857        }
1858        ximageHTML = ximageHTML + '</div>'
1859        if (a_desc[k] !== undefined) {
1860            ximageHTML = ximageHTML + '<div class="search_panal_product_title"> ' + a_desc[k] + ' </div>';
1861        }
1862        ximageHTML = ximageHTML + '</a>'
1863        ximageHTML = ximageHTML + '</div>'
1864
1865        ximageHTML = ximageHTML + '</div>'
1866    }
1867
1868    ximageHTML = ximageHTML + '</div>'
1869
1870    ximageHTML = ximageHTML + "<div class='view_all_btn_cont'><a href='/search/" + trimstr(searchobj.txtsearch.value) + "' class='view_all_btn_cont_btn'>View all results<i class='icon-chevron-right- 1'></i></a></div>";
1871    ximageHTML = ximageHTML + "<hr class='separator_full'>"
1872
1873    searchbox_html = searchbox_html + ximageHTML
1874    if (a_dept.length > 0) {
1875        if (a_dept[0].indexOf('^') >= 0) {
1876
1877            searchbox_html = searchbox_html + "<span class='srch-head'>Relevant Department Matches</span>"
1878            searchbox_html = searchbox_html + '<div class="search_product_grid relevant_department_grid">'
1879            for (k = 0; k < a_dept.length; k++) {
1880                if (k >= MaxDept) {
1881                    break;
1882                }
1883                if (a_dept[k].indexOf('^') >= 0) {
1884
1885                    var a_currdept = a_dept[k].split("^")
1886
1887                    searchbox_html = searchbox_html + '<div class="search_product_grid_item">'
1888                    searchbox_html = searchbox_html + '<div class="search_panal_product">'
1889                    searchbox_html = searchbox_html + "<a title='" + a_currdept[1] + "' href='/" + a_currdept[2] + "'>"
1890                    searchbox_html = searchbox_html + '<div class="search_panal_product_img"  >'
1891                    searchbox_html = searchbox_html + '<img id="DeptImage' + k + '" src="' + a_currdept[0] + '" alt="" class="img-fluid" >'
1892                    searchbox_html = searchbox_html + '</div>'
1893                    searchbox_html = searchbox_html + '<div class="search_panal_product_title">' + a_currdept[1] + '</div>'
1894                    searchbox_html = searchbox_html + '</a>'
1895                    searchbox_html = searchbox_html + '</div>'
1896                    searchbox_html = searchbox_html + '</div>'
1897                }
1898            }
1899
1900
1901            searchbox_html = searchbox_html + '</div>'
1902
1903        }
1904    }
1905
1906    searchbox_html = searchbox_html + '</div>'
1907
1908    
1909
1910    if (xctr > 0 && ytext.trim().length > 0) {        
1911        $("#searchCont_main").addClass("hide");
1912        document.getElementById("autoSuggest_container").innerHTML = searchbox_html;
1913        document.getElementById("autoSuggest_container").style.display = "block";
1914    }
1915    else if (xctr == 0 && ytext.trim().length > 0) {        
1916        $("#searchCont_main").addClass("hide");
1917        document.getElementById("autoSuggest_container").innerHTML = "";
1918    }
1919    else {        
1920        $("#searchCont_main").removeClass("hide");
1921        document.getElementById("autoSuggest_container").innerHTML = "";        
1922    }
1923
1924
1925  
1926
1927
1928}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.