PageSourceSearch

http://kam-pod.gov.ua/modules/mod_universal_ajaxlivesearch/cache/95/61b8a1df9b63cb822dc99711cf46ba67.js

js kam-pod.gov.ua collected 2026-10-02 05:30:43 UTC 29,959 bytes, 820 lines download raw bytes

1(function(){dojo.require('dojo.uacss');
2
3dojo.declare("AJAXSearchBase", null, {
4  constructor: function(args) {
5    dojo.mixin(this,args);
6    this.list = new Array(); // the search result array
7    this.selected = 0;   //the actual selected search result
8    this.pluginCounter = new Array();
9    this.timeStamp = 0; // the latest timestamp 
10    this.categoryChooserVisible = 0; // Is the category chooser visible? 0:No 1:Yes
11    this.resultsVisible = 0; // Are the results visible? 0:No 1:Yes
12    this.fadeInResult=1; // At first time the results should come up with fade-in effect 
13    dojo.attr(this.textBox, "x-webkit-speech", "");
14    if(dojo.isIE <= 7){
15      var w = dojo.position(this.textBox.parentNode).w-dojo.style(this.textBox, 'paddingLeft')-dojo.style(this.textBox, 'paddingRight');
16      dojo.style(this.textBox, 'width', (w-1)+'px');
17    }
18    
19    this.searchBoxContainer = dojo.query(".offlajn-ajax-search-container", this.node)[0];
20    
21	  if(this.catChooser){
22      this.categoryChooser = dojo.query(".category-chooser", this.searchForm)[0];
23      dojo.place(this.searchCategories,dojo.body());
24      this.searchCategoriesList = dojo.query(".search-categories-inner div", this.searchCategories);
25    }
26
27	  if(this.catChooser){
28      dojo.connect(this.categoryChooser,'onclick',this,'showCategoryChooser');
29      dojo.connect(this.categoryChooser, "onclick", this, "stopCategoryChooserEventBubble");
30    }
31    
32    dojo.attr(this.textBox, "value", this.searchBoxCaption);
33    dojo.addClass(this.textBox, "search-caption-on");
34    this.suggestBox.value= ""
35
36    if(this.searchResult){
37	  dojo.connect(this.textBox,'onkeyup',this,'type');
38    dojo.connect(this.textBox,'oncompositionupdate',this,'type'); //Japanese support
39    }
40    
41	  dojo.connect(this.textBox,'onfocus',this,'textBoxFocus');
42	  dojo.connect(this.textBox,'onblur',this,'textBoxBlur');
43	  dojo.connect(this.textBox,'onwebkitspeechchange',this,'soundEnd');
44
45    //if suggestion
46	  if(this.keywordSuggestion=="1"){
47      dojo.connect(this.textBox,'onkeyup',this,'suggest');
48    }
49    dojo.connect(this.suggestBox,'onfocus',this,'suggestBoxFocus');
50    dojo.connect(this.suggestBox, "onclick", this, "stopEventBubble");
51    
52	  dojo.connect(this.closeButton,'onclick',this,'closeResults');
53	  dojo.connect(this.searchButton,'onclick',this,'loadResult');
54
55    dojo.connect(this.textBox, "onclick", this, "stopInputEventBubble");
56
57	  if(this.catChooser)
58    dojo.forEach(this.searchCategoriesList, function(entry, i){
59      dojo.connect(entry, "onclick", this, "categorySelection");
60      dojo.connect(entry, "onclick", this, "stopEventBubble");
61    },this);
62	  dojo.connect(window,'onresize',this,'onResize');
63	  	  
64  },  
65
66  stopEventBubble: function(e){
67    e.stopPropagation();
68  },
69  
70  stopInputEventBubble: function(e){
71    this.dummyCloseResult = 1;
72  },
73  
74  stopCategoryChooserEventBubble: function(e){
75    this.dummyHideCategory = 1;
76  },
77  
78  loadResult : function(e){
79    if(this.targetsearch == 3) {
80      e.stopPropagation();
81    } else {
82      if(this.textBox.value.length >=this.minChars){    
83        this.searchForm.submit();
84      }
85    }
86  },  
87  
88  type: function(evt, force){
89    if (window.event) {
90      this.keycode = window.event.keyCode;
91      this.ktype = window.event.type;
92    } else if (evt) {
93      this.keycode = evt.which;
94      this.ktype = evt.type;
95    }
96    if (this.t)
97      clearTimeout(this.t);
98    this.t = setTimeout(dojo.hitch(this, function() {
99      if(((this.targetsearch == 3 && this.keycode==13) || (this.keycode>40 || this.keycode==13) || this.keycode==32 || this.keycode==8 || this.keycode==0 || this.ktype=="click") && this.textBox.value.length >=this.minChars || force==1){
100       var categories = new Array();
101        dojo.forEach(this.searchCategoriesList, function(entry, i){
102          if (dojo.hasClass(entry, "selected"))
103            categories.push(dojo.attr(entry,"id").match(/\d+/)[0]);
104        });
105        dojo.style(this.closeButton, "visibility", "visible");
106        dojo.style(this.textBox,"paddingRight","52px");
107        dojo.addClass(this.closeButton, "search-area-loading");
108        dojo.xhrGet({
109            url : this.searchFormUrl,
110            content: { option: "com_universal_ajax_live_search", lang: this.lang, format: "raw", module_id : this.moduleId, search_exp: this.textBox.value, 'categ[]' : categories },
111            handleAs:"text",
112            preventCache : true,
113            load: dojo.hitch(this,'processResult'),
114            error: function(e){
115              console.log('Error: '+e);
116            }
117        });     
118      }
119    }), this.keypressWait);
120  },
121  
122  suggest: function(evt){
123    if (window.event) {
124      this.keycode = window.event.keyCode;
125      this.ktype = window.event.type;
126    } else if (evt) {
127      this.keycode = evt.which;
128      this.ktype = evt.type;
129    }    
130    if((this.keycode>40 || this.keycode==32 || this.keycode==8 || this.keycode==0 || this.ktype=="click") && this.textBox.value.length >=2 || this.keycode==46 || this.keycode==8 ){
131      dojo.xhrGet({
132          url : this.searchFormUrl,
133          content: { option: "com_universal_ajax_live_search", format: "raw", search_exp: this.textBox.value, suggest: 1 },
134          handleAs:"text",
135          preventCache : true,
136          load: dojo.hitch(this,'processSuggestion'),
137          error: function(e){
138            console.log('Error: '+e);
139          }
140      });     
141    }else if(this.keycode==39 && this.getCaret(this.textBox)==this.textBox.value.length && this.suggestBox.value!= ""){
142      this.textBox.value+= this.suggestBox.value.substr(this.textBox.value.length);
143      this.type(evt,1);
144    }
145  },
146  
147  suggestBoxFocus : function(evt){
148    this.textBox.focus();
149  },
150  
151  getCaret: function (el) {
152    if (el.selectionStart) { 
153      return el.selectionStart; 
154    } else if (document.selection) { 
155      el.focus(); 
156  
157      var r = document.selection.createRange(); 
158      if (r == null) { 
159        return 0; 
160      } 
161  
162      var re = el.createTextRange(), 
163          rc = re.duplicate(); 
164      re.moveToBookmark(r.getBookmark()); 
165      rc.setEndPoint('EndToStart', re); 
166  
167      return rc.text.length; 
168    }  
169    return 0; 
170  },
171  
172  saveSuggestion : function(evt){
173    dojo.xhrGet({
174        url : this.searchFormUrl,
175        content: { option: "com_universal_ajax_live_search", format: "raw", search_exp: this.textBox.value, savesuggest:1 },
176        handleAs:"text",
177        preventCache : true
178    });
179    
180    setTimeout(dojo.hitch(this, function(ct) {
181      if(!ct) 
182        document.location.href = dojo.attr(this.list[this.selected-1],"href");
183      else
184        document.location.href = ct.href;
185    },evt?evt.currentTarget:null),200);    
186  },
187  
188  processSuggestion : function(d,xhr){
189    try{
190      var data = eval('('+d+')');
191    }catch(err){
192      alert('SuggestionError: '+d); return;
193    }
194    if (data[0])
195      this.suggestBox.value= this.textBox.value + data[0].suggestion.toLowerCase().substr(this.textBox.value.length);
196    else
197      this.suggestBox.value= "";
198  },
199  
200   changeText: function(e) {
201    this.textBox.value = e.currentTarget.innerHTML;
202  },
203  
204  textBoxFocus : function(){
205    if (this.catChooser) this.hideCategoryChooser();
206    dojo.addClass(this.searchBoxContainer,"active");
207    if(dojo.hasClass(this.textBox, "search-caption-on")){
208      dojo.attr(this.textBox, "value", "");
209      dojo.removeClass(this.textBox, "search-caption-on");
210    }
211    dojo.addClass(this.node,"active");
212  },
213  
214  soundEnd : function(e) {
215    this.textBoxFocus();
216    dojo.attr(this.textBox, "value", e.results[0].utterance);
217    this.type(e,1);
218  },
219  
220
221  textBoxBlur : function(){
222    if(dojo.hasClass(this.searchBoxContainer, "active") && !this.resultsVisible){
223      dojo.removeClass(this.searchBoxContainer,"active");
224    }
225    if (this.textBox.value.length==0){
226      dojo.attr(this.textBox, "value", this.searchBoxCaption);
227      dojo.addClass(this.textBox, "search-caption-on");
228      this.suggestBox.value= ""
229    }
230    if(dojo.hasClass(this.node, "active")) dojo.removeClass(this.node,"active");
231  },
232  
233  showCategoryChooser : function(evt){
234    if(!this.categoryChooserVisible){
235      this.textBox.blur();
236      if(dojo.style(this.closeButton, "visibility")== "visible"){ //remove results if the were
237        dojo.attr(this.textBox, "value", "");
238        this.closeResults();
239      }    
240    
241      if(this.categoryFx && this.categoryFx.status() == "playing"){
242        this.categoryFx.stop();
243      }
244      this.categoryChooserVisible = 1;
245      this.textBoxPosition = dojo.position(this.textBox, true);
246      
247      var left = this.getCategoryLeftPosition();
248      
249      dojo.style(this.searchCategories,{
250        left: left+'px',
251        top: (this.textBoxPosition.y+this.textBoxPosition.h-10+this.categoryChooserTopCorrection)+'px',
252        visibility : 'visible',
253        opacity : '0'
254      });
255      this.categoryFx = dojo.animateProperty({node: this.searchCategories, properties: {opacity : 1, top: { end:this.textBoxPosition.y+this.textBoxPosition.h+this.categoryChooserTopCorrection, units:"px" }}, duration: 200}).play();
256      dojo.addClass(this.categoryChooser,"opened");
257      this.hideCategories = dojo.connect(dojo.body(),'onclick',this,'hideCategoryChooser');
258    }else{
259      this.hideCategoryChooser();
260    }
261  },
262  
263  hideCategoryChooser : function(evt){
264    if(this.dummyHideCategory == 1){
265      this.dummyHideCategory = 0;
266      return;
267    }
268    dojo.disconnect(this.hideCategories);
269    if(this.categoryFx && this.categoryFx.status() == "playing"){
270      this.categoryFx.stop();
271    }
272    this.categoryFx = dojo.animateProperty({
273        node: this.searchCategories, 
274        properties: {opacity : 0}, 
275        onEnd: function(){ 
276          dojo.style(this.node,{visibility : 'hidden'})}, 
277        duration: 200
278        }).play();
279    dojo.removeClass(this.categoryChooser,"opened");
280    this.categoryChooserVisible = 0;
281  },
282  
283  categorySelection: function(evt){
284    var node = evt.currentTarget;
285    if(dojo.hasClass(node, "selected"))
286      dojo.removeClass(node, "selected")
287    else
288      dojo.addClass(node, "selected");
289          
290  }
291
292});
293
294dojo.copyTouch = function(sourceObj, targetObj){
295    targetObj.screenX = sourceObj.screenX;
296    targetObj.screenY = sourceObj.screenY;
297    targetObj.identifier = sourceObj.identifier;
298};
299
300/*The drop-style searches base*/
301dojo.declare("AJAXSearchDropBase", AJAXSearchBase, {
302  constructor: function(args) {
303    dojo.mixin(this,args);
304    this.categoryChooserTopCorrection = 0;
305
306    this.searchResults = dojo.create("div", {id: "search-results"+this.id}, dojo.body());
307    this.searchResultsMoovable = dojo.create("div", {id: "search-results-moovable"+this.id}, this.searchResults);
308    this.searchResultsInner = dojo.create("div", {id: "search-results-inner"+this.id}, this.searchResultsMoovable);
309    
310    this.touch = {screenX: 0, screenY: 0, identifier: ''};
311    dojo.connect(this.searchResults, "onclick", this, "stopEventBubble");
312
313    dojo.connect(document, "onclick", this, "closeResults");
314	  dojo.connect(this.textBox,'onkeypress',this,'arrowNavigation');
315  },
316  
317  onResize: function(){
318    this.textBoxPos = dojo.position(this.searchForm.parentNode, true);
319    var left = this.textBoxPos.x;
320    if (this.resultAlign==1){ // if search result aligned to right
321      left+=this.textBoxPos.w-this.searchRsWidth;
322    }
323    dojo.style(this.searchResults,{
324      left: left+'px',
325      top: this.textBoxPos.y+this.textBoxPos.h+this.resultboxTopOffset+'px'
326    });
327    if(this.dynamicResult=="1"){
328      dojo.style(this.searchResults,{
329        left: left+'px',
330        top: this.textBoxPos.y+this.textBoxPos.h+this.resultboxTopOffset+'px',
331        width : this.textBoxPos.w+'px'
332      });    
333      dojo.style(this.searchResultsInner,{
334        width : this.textBoxPos.w+'px'
335      });
336      
337      if(dojo.query(".no-result", this.searchResults).length>0)
338      dojo.style(dojo.query(".no-result", this.searchResults)[0],{
339        width : this.textBoxPos.w+'px'
340      });
341      
342      dojo.forEach(dojo.query(".result-element", this.searchResults), function(entry, i){
343        dojo.style(entry,{
344          width : this.textBoxPos.w+'px'
345        });
346        
347        dojo.style(dojo.query("span", entry)[0],{
348          width : (this.textBoxPos.w-17)+'px'
349        });      
350        
351        if(this.showIntroText == 1) {
352          dojo.style(dojo.query("span", entry)[1],{
353            width : (this.textBoxPos.w-17)+'px'
354          });      
355        }
356        
357        if(dojo.hasClass(entry, "result-products")){
358          dojo.style(dojo.query("span", entry)[0],{
359            width : (this.textBoxPos.w-12-this.searchImageWidth-17)+'px'
360          });      
361          if(this.showIntroText == 1) {
362            dojo.style(dojo.query("span", entry)[1],{
363              width : (this.textBoxPos.w-12-this.searchImageWidth-17)+'px'
364            });      
365          }
366        }
367        
368      },this);
369      this.searchRsWidth = this.textBoxPos.w;
370    }
371  },
372  
373  processResult : function(d,xhr){
374    d = d.match(/startofofflajnsearchresult(.+)endofofflajnsearchresult/)[1];
375    try{
376      var data = eval('('+d+')');
377    }catch(err){
378      alert('Error: '+d); return;
379    }
380    // timestamp check if this is the latest search
381    var regexp = /.*&dojo\.preventCache=(\d+)/i;
382    var result = xhr.url.match(regexp);
383    if (result[1]){
384      if (result[1]>this.timeStamp){
385        this.timeStamp = result[1]; 
386      }else{
387        dojo.removeClass(this.closeButton, "search-area-loading");
388        dojo.style(this.closeButton, "visibility", "visible");
389        dojo.style(this.textBox,"paddingRight","52px");
390        return;
391      }
392    }
393    
394    dojo.attr(this.searchResultsInner, { innerHTML: "" });
395    this.list=[];
396    this.pluginCounter=[];
397    this.selected = 0;
398    this.onResize();
399 
400    if(data.length!=0 && !data.nores){
401      this.paginationBand = new Array();
402      var actualPlugin = 0;
403      for(var i in data){
404        this.paginationBand[actualPlugin] = new Array;
405        var pluginResults = data[i];
406        var pluginNameDiv = dojo.create("div", {'class': "plugin-title"}, this.searchResultsInner);
407        if (actualPlugin==0){
408          dojo.addClass(pluginNameDiv, 'first');
409        }
410        /*Adding plugin title*/
411        dojo.create("div", {'class': "plugin-title-inner", innerHTML: i+" ("+pluginResults.length+")"}, pluginNameDiv);
412
413        /*Generate pagination*/
414        this.generatePagination(pluginNameDiv,pluginResults.length,actualPlugin);
415        this.pluginCounter.push(pluginResults.length);
416
417        /*Generate resultList*/
418        this.generateResultList(pluginResults, actualPlugin);
419        
420        actualPlugin++;
421      }
422      /*Set the selected item to 0 (it is invisible)*/
423      this.selectItem(0);
424    } 
425
426    this.tags="";
427    
428    if(this.searchResultsInner.childNodes.length){
429      this.innerHeight = dojo.marginBox(this.searchResultsInner).h;     
430    } else if (data.nores && data.nores[0] && data.nores[0].tag && (data.nores.length>1 || this.textBox.value!=data.nores[0].tag)) { /* No results but keywords found. */
431      var pluginNameDiv = dojo.create("div", {'class': "plugin-title first suggest"}, this.searchResultsInner);
432      dojo.create("div", {'class': "plugin-title-inner", innerHTML: this.stext}, pluginNameDiv);
433      dojo.create("div", {'class': "ajax-clear"}, pluginNameDiv);
434      for (var j=0;j<data.nores.length-1;j++) {
435        if (this.textBox.value!=data.nores[j].tag)
436          this.tags += "<a class='sugg-keyword'>"+data.nores[j].tag+"</a>, ";
437      }
438      this.tags += "<a class='sugg-keyword'>"+data.nores[j].tag+"</a>";
439      
440      dojo.create("div", {'class': "no-result-suggest", innerHTML: '<span>'+this.tags+'</span>'}, this.searchResultsInner);
441      dojo.query("a[class=sugg-keyword]").connect("onclick", this,  "changeText");
442      dojo.query("a[class=sugg-keyword]").connect("onclick", this,  "type");
443      this.innerHeight = dojo.marginBox(this.searchResultsInner).h;
444    }else{ /* No result for the keyword */
445      var pluginNameDiv = dojo.create("div", {'class': "plugin-title first"}, this.searchResultsInner);
446      dojo.create("div", {'class': "plugin-title-inner", innerHTML: this.noResultsTitle}, pluginNameDiv);
447      dojo.create("div", {'class': "ajax-clear"}, pluginNameDiv);
448      dojo.create("div", {'class': "no-result", innerHTML: '<span>'+this.noResults+'</span>'}, this.searchResultsInner);
449      this.innerHeight = dojo.marginBox(this.searchResultsInner).h;
450    }
451    dojo.removeClass(this.closeButton, "search-area-loading");
452    this.onResize();
453    this.animateResult();
454  },
455
456  /*Generate pagination*/
457  generatePagination : function(pluginNameDiv, dataLength, actualPlugin){
458    this.paginationBand[actualPlugin].paginators= new Array();
459    if (dataLength>this.productsPerPlugin){ //not generate if there is just 1 page
460      var pagination = dojo.create("div", {'class': "pagination "+"paginator-"+actualPlugin}, pluginNameDiv);
461      var pageNumber = Math.floor(dataLength/this.productsPerPlugin+0.99999);
461  // 0.99999 constant because: 1.00001 must round to 2, 2.00001 to 3, etc..
462      for(var num=0;num < pageNumber; num++){ 
463        var paginatorElement = dojo.create("div", {'class': "pager"}, pagination);
464        paginatorElement.parentPlugin = actualPlugin;
465        paginatorElement.page = num;
466    
467     	  dojo.connect(paginatorElement,'onclick',this,'moovePage'); // coonect an event to paginators
468  
469        if (num==0){
470          dojo.addClass(paginatorElement, 'active');
471          this.paginationBand[actualPlugin].activePaginator = paginatorElement; 
472        }
473        
474        this.paginationBand[actualPlugin].paginators.push(paginatorElement); //adding the paginators to the band to adding active class when arrows are in use
475      }
476    }
477    dojo.create("div", {'class': "ajax-clear"}, pluginNameDiv);
478  },
479
480  /*Generate resultList*/
481  generateResultList : function(pluginResults, actualPlugin){
482  
483    var pageContainer = dojo.create("div", {'class': "page-container"}, this.searchResultsInner); 
484    var pageBand = dojo.create("div", {'class': "page-band "+"page-band-"+actualPlugin}, pageContainer); 
485    this.paginationBand[actualPlugin].band = pageBand;
486    pageBand.currentPage=0;
487    pageBand.maxPage = Math.floor(pluginResults.length/this.productsPerPlugin+0.99999);
488    pageBand.plugin = actualPlugin;
489    //connect the mouse scroller
490    if(this.enableScroll==1){
491      dojo.connect(pageBand, (!dojo.isMozilla ? "onmousewheel" : "DOMMouseScroll"), this, "scrollResultList");
492  	  dojo.connect(pageBand, "ontouchstart", this, "touchStart");
493  	  dojo.connect(pageBand, "ontouchend", this, "touchEnd");
494  	  dojo.connect(pageBand, "ontouchmove", dojo.stopEvent);
495    }
496    var page = null;
497    
498    for(var j=0;j<pluginResults.length;j++){
499      if (j%this.productsPerPlugin==0){ // 2 is the count to show
500        page = dojo.create("div", {'class': "page-element list"+Math.floor(j/this.productsPerPlugin)}, pageBand);
501      }
502      var atag = null;
503      var introText="";
504      if (this.showIntroText==1 && pluginResults[j].text){
505        introText = '<span class="small-desc">'+pluginResults[j].text+'</span>'; 
506      }
507      if(pluginResults[j].product_img){ //Virtuemart products
508        atag = dojo.create("a", {'class': "result-element result-products", 'onclick':"return false;", innerHTML: pluginResults[j].product_img+'<span>'+pluginResults[j].title+'</span>'+introText, href:pluginResults[j].href, target: (this.linktarget=="1" ? '_blank' : '') }, page);
509      }else{  // Other search results
510        atag = dojo.create("a", {'class': "result-element", 'onclick':"return false;", innerHTML: '<span>'+pluginResults[j].title+'</span>'+introText, href:pluginResults[j].href}, page);
511      }
512      
513      // SUGGESTION
514      dojo.connect(atag,'onclick',this,'saveSuggestion');
515      
516      atag.plugin=actualPlugin;
517      atag.item=j;
518      
519      this.list.push(atag);
520      dojo.create("div", {'class': "ajax-clear"}, atag);
521    }
522    if(pluginResults.length<this.productsPerPlugin){
523      dojo.style(pageContainer, "height", dojo.marginBox(pageBand).h +"px");
524    }
525    if(pluginResults.length>=this.seemoreAfter){
526    dojo.create("div", {'id':"seemore",'class': "seemore", innerHTML: '<span>'+this.seeMoreResults+'</span>'}, this.searchResultsInner);
527    dojo.connect(dojo.byId("seemore"),'onclick',this,'loadResult');
528    dojo.removeClass(this.searchResultsInner, "withoutseemore");
529    //dojo.style(this.searchResultsInner,"paddingBottom","0px");
530    }else{
531    dojo.addClass(this.searchResultsInner, "withoutseemore");
532     //dojo.style(this.searchResultsInner,"paddingBottom","10px");
533    }
534  },
535
536  moovePage : function(event){
537    var pager = event.target;
538    var band = this.paginationBand[pager.parentPlugin].band;
539    dojo.removeClass(this.paginationBand[pager.parentPlugin].activePaginator,"active");
540    dojo.addClass(pager, "active");
541    this.paginationBand[pager.parentPlugin].activePaginator = pager;
542     
543    if(band.actFx && band.actFx.status() == "playing"){
544      band.actFx.stop();
545    }
546    band.actFx = dojo.animateProperty({node: band, properties: {left: -pager.page*this.searchRsWidth}, duration: 500}).play();
547    this.textBox.focus();
548  },
549  
550  scrollPluginResults : function(band, page){
551    if(band.actFx && band.actFx.status() == "playing"){
552      band.actFx.stop();
553    }
554    band.actFx = dojo.animateProperty({node: band, properties: {left: -page*this.searchRsWidth}, duration: 250}).play();
555    band.currentPage=page;
556  },
557  
558  animateResult : function(){
559    if(this.actFx && this.actFx.status() == "playing"){
560      this.actFx.stop();
561    }
562    this.resultsVisible = 1;
563    dojo.style(this.searchResults, "visibility", "visible");
564    if(this.innerHeight){
565      this.actFx = this.getResultBoxAnimation();
566    } else{ // No results found
567      this.actFx = dojo.animateProperty({
568          node: this.searchResultsMoovable, 
569          properties: {
570              height: 0
571          }, 
572          duration: 500, 
573          onEnd : dojo.hitch(this,'removeResults')
574          }).play();
575    }
576    dojo.style(this.closeButton, "visibility", "visible");
577    dojo.style(this.textBox,"paddingRight","52px");
578  },
579  
580  closeResults : function(e){
581  dojo.style(this.textBox,"paddingRight","30px");
582    if(e && e.button && e.button > 0) return;
583    if(this.dummyCloseResult == 1){
584      this.dummyCloseResult = 0;
585      return;
586    }
587    if(this.actFx && this.actFx.status() == "playing"){
588      if(dojo.hasClass(this.textBox, "search-caption-on"))
589        return;
590      this.actFx.stop();
591    }
592    this.actFx = this.getCloseResultBoxAnimation();
593    dojo.style(this.closeButton, "visibility", "hidden");
594    dojo.style(this.textBox,"paddingRight","30px");
595    dojo.attr(this.textBox, "value", this.searchBoxCaption);
596    dojo.addClass(this.textBox, "search-caption-on");
597    this.suggestBox.value= ""
598    
599  },
600  
601  removeResults: function(){
602    this.fadeInResult=1;
603    dojo.attr(this.searchResultsInner, { innerHTML: "" });
604    if(this.searchResultsInner.childNodes.length){
605      this.innerHeight = dojo.marginBox(this.searchResultsInner).h;
606    }else{
607      this.innerHeight=0;
608    }
609    dojo.style(this.searchResults, "visibility", "hidden");
610    this.resultsVisible=0;
611    if(dojo.hasClass(this.searchBoxContainer, "active") && !this.resultsVisible){
612      dojo.removeClass(this.searchBoxContainer,"active");
613    }
614  },
615  
616  /*keyCodes: 
617    UP: 38
618    DOWN: 40
619    ENTER: 13*/
620    
621  arrowNavigation: function(evt){
622    if(evt.keyCode==27){ //blur if esc pressed
623      this.textBox.blur();
624      if(dojo.style(this.closeButton, "visibility")== "visible"){ //remove results if the were
625        dojo.attr(this.textBox, "value", "");
626        this.closeResults();
627      }
628    }
629    if(this.list.length){
630      if(evt.keyCode==38){
631        this.selectItem(this.selected-1);
632      }else if (evt.keyCode==40){
633        this.selectItem(this.selected+1);
634      }else if (evt.keyCode==13){
635        if(this.selected==0){
636          this.loadResult();
637        }else{
638          this.saveSuggestion();
639          // Here was the href loading
640        }
641      }
642      
643      if(this.selected>0){
644        var actPlugin = this.list[this.selected-1].plugin;
645        var actPluginItem = this.list[this.selected-1].item;
646        var band = this.paginationBand[actPlugin].band;
647        var pgNumber = Math.floor(actPluginItem/this.productsPerPlugin);
648        if(this.paginationBand[actPlugin].activePaginator){
649          dojo.removeClass(this.paginationBand[actPlugin].activePaginator,"active");
650          
651          this.scrollPluginResults(band,pgNumber);
652          var pager = this.paginationBand[actPlugin].paginators[pgNumber];
653          dojo.addClass(pager, "active");
654          this.paginationBand[actPlugin].activePaginator = pager;
655        } 
656      }
657      
658    }else if(evt.keyCode==13){
659    	this.loadResult();
660    }
661  },
662  //scrolling the results
663  scrollResultList : function(evt){
664    var scroll = evt[(!dojo.isMozilla ? "wheelDelta" : "detail")] * (!dojo.isMozilla ? 1 : -1);
665    var band = evt.currentTarget;
666    if (band.maxPage>1){
667      var actPlugin = band.plugin;
668      dojo.removeClass(this.paginationBand[actPlugin].activePaginator,"active");
669      var pgNumber = band.currentPage;
670      if(scroll<0 && pgNumber<band.maxPage-1){
671        pgNumber++;
672      }else if(scroll<0 && pgNumber>=band.maxPage-1){
673        pgNumber=0;
674      }else if(scroll>0 && pgNumber>0){
675        pgNumber--;
676      }else if(scroll>0 && pgNumber<=0){
677        pgNumber=band.maxPage-1;
678      }
679      this.scrollPluginResults(band,pgNumber);
680      var pager = this.paginationBand[actPlugin].paginators[pgNumber];
681      dojo.addClass(pager, "active");
682      this.paginationBand[actPlugin].activePaginator = pager;
683      dojo.stopEvent(evt);
684    }
685  },
686  
687  selectItem : function(num){
688    if(num>=this.list.length+1){
689      num-=this.list.length+1;
690    }
691    if(num<0){
692      num+=this.list.length+1;
693    }
694    if(this.list[this.selected-1]){
695      dojo.removeClass(this.list[this.selected-1], "selected-element");
696    }
697    if(this.list[num-1]){
698      dojo.addClass(this.list[num-1], "selected-element");
699    }
700    this.selected=num;
701  },
702  
703  post_to_url: function(path, params, method) {
704    method = method || "post"; // Set method to post by default, if not specified.
705
706    // The rest of this code assumes you are not using a library.
707    // It can be made less wordy if you use one.
708    var form = document.createElement("form");
709    form.setAttribute("method", method);
710    form.setAttribute("action", path);
711
712    for(var key in params) {
713        var hiddenField = document.createElement("input");
714        hiddenField.setAttribute("type", "hidden");
715        hiddenField.setAttribute("name", key);
716        hiddenField.setAttribute("value", params[key]);
717
718        form.appendChild(hiddenField);
719    }
720
721    document.body.appendChild(form);
722    form.submit();
723  },
724  
725  /*TOUCH Evenets*/
726  touchStart: function(e){
727    dojo.copyTouch(e.changedTouches[0], this.touch);
728  },
729  
730  touchEnd: function(e){
731    if(this.touch.identifier == e.changedTouches[0].identifier){
732      var dist = Math.sqrt(Math.pow(e.changedTouches[0].screenX-this.touch.screenX, 2) + Math.pow(e.changedTouches[0].screenY-this.touch.screenY, 2));
733      if(dist > 80){
734        var deg = Math.asin((e.changedTouches[0].screenY-this.touch.screenY)/dist)*180/Math.PI;
735        if(deg < 45 && deg > -45){ //horizontal
736          var scroll = e.changedTouches[0].screenX-this.touch.screenX;
737            this.paginateTouch(e,scroll);
738        }
739      }
740    }
741  },
742  
743  paginateTouch: function(evt, direction){
744    var band = evt.currentTarget;
745    if (band.maxPage>1){
746      var actPlugin = band.plugin;
747      dojo.removeClass(this.paginationBand[actPlugin].activePaginator,"active");
748      var pgNumber = band.currentPage;
749      if(direction<0 && pgNumber<band.maxPage-1){
750        pgNumber++;
751      }else if(direction<0 && pgNumber>=band.maxPage-1){
752        pgNumber=0;
753      }else if(direction>0 && pgNumber>0){
754        pgNumber--;
755      }else if(direction>0 && pgNumber<=0){
756        pgNumber=band.maxPage-1;
757      }
758      this.scrollPluginResults(band,pgNumber);
759      var pager = this.paginationBand[actPlugin].paginators[pgNumber];
760      dojo.addClass(pager, "active");
761      this.paginationBand[actPlugin].activePaginator = pager;
762      dojo.stopEvent(evt);
763    }
764  }
765    
766});
767var AJAXSearch = {};
768
769dojo.declare("AJAXSearchelegant", AJAXSearchDropBase, {
770  constructor: function(args) {
771    this.resultboxTopOffset = 0;
772  },
773  
774  closeResults : function(e){
775  dojo.style(this.textBox,"paddingRight","39px");
776    if(e && e.button && e.button > 0) return;
777    if(this.dummyCloseResult == 1){
778      this.dummyCloseResult = 0;
779      return;
780    }
781    if(this.actFx && this.actFx.status() == "playing"){
782      if(dojo.hasClass(this.textBox, "search-caption-on"))
783        return;
784      this.actFx.stop();
785    }
786    this.actFx = this.getCloseResultBoxAnimation();
787    dojo.style(this.closeButton, "visibility", "hidden");
788   // dojo.style(this.textBox,"paddingRight","30px");
789    dojo.attr(this.textBox, "value", this.searchBoxCaption);
790    dojo.addClass(this.textBox, "search-caption-on");
791    this.suggestBox.value= ""
792    
793  },  
794  
795  getResultBoxAnimation: function(){
796    return dojo.animateProperty({
797      node: this.searchResultsMoovable, 
798      properties: {
799        height: {start: dojo.style(this.searchResultsMoovable, 'height'), end: this.innerHeight}
800      }, 
801      duration: 500
802    }).play();
803  },
804  
805  getCloseResultBoxAnimation: function(){
806    return dojo.animateProperty({
807      node: this.searchResultsMoovable, 
808      properties: {
809        height: 0
810      }, 
811      duration: 500, 
812      onEnd : dojo.hitch(this,'removeResults')
813    }).play();
814  },
815  
816  getCategoryLeftPosition: function(){
817    return this.textBoxPosition.x;
818  }
819});
820})();

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.