
function autoComplete(resultsId,localMenu,relPath,staticRelPath){this.relative=relPath;this.staticRelPath=staticRelPath;this.rId=resultsId;this.localMenu=localMenu;var self=this;iGEvents.addEvent(document.body,"click",function(){self.clearAll();});}
autoComplete.prototype={rId:null,index:0,xhr_object:null,lastSearch:"",inputField:null,localMenu:null,clearAll:function(){var el=document.getElementById(this.rId);el.style.display="none";},relative:"../",complete:function(e,aInputEl){var searchString=aInputEl.value;this.index++;this.inputField=aInputEl;var index=this.index;var self=this;var kC=(window.event)?event.keyCode:e.keyCode;var Esc=(window.event)?27:e.DOM_VK_ESCAPE
if(kC==Esc)this.clearAll();else window.setTimeout(function(){self.doComplete(index,searchString)},500);},doComplete:function(index,aSearchString){if(index!=this.index)return;if(!aSearchString||aSearchString.length==0){this.clearAll();return;}
if(this.xhr_object!=null)this.xhr_object.abort();var fichier=this.relative+"ajax/ajax.php?cmd=search&search="+encodeURIComponent(aSearchString);if(window.XMLHttpRequest)
this.xhr_object=new XMLHttpRequest();else if(window.ActiveXObject)
this.xhr_object=new ActiveXObject("Microsoft.XMLHTTP");else
return;var self=this;this.xhr_object.onreadystatechange=function(){if(self.xhr_object.readyState==4)
self.doCompleteSuccess();}
this.xhr_object.open("GET",fichier,true);this.xhr_object.send(null);},doCompleteSuccess:function(){var html=this.xhr_object.responseText;var results=document.getElementById(this.rId);results.innerHTML=html;results.style.position="absolute";results.style.display="block";var centerCol=document.getElementById("centerCol");if(centerCol)
{xOffset=-centerCol.offsetLeft;yOffset=-centerCol.offsetTop;}
else
{xOffset=0;yOffset=0;}
results.style.left=(this.getLeft(this.inputField)+xOffset)+"px";results.style.top=(this.getTop(this.inputField)+this.getHeight(this.inputField)+1+yOffset)+"px";results.style.zIndex=330;this.localMenu.initMenu(results);this.localMenu.maketooltip_dl(results);},getLeft:function(MyObject)
{if(MyObject.offsetParent)
return(MyObject.offsetLeft+this.getLeft(MyObject.offsetParent));else
return(MyObject.offsetLeft);},getTop:function(MyObject)
{if(MyObject.offsetParent)
return(MyObject.offsetTop+this.getTop(MyObject.offsetParent));else
return(MyObject.offsetTop);},getHeight:function(MyObject)
{if(MyObject.clientHeight)
return(MyObject.clientHeight);else
return(MyObject.offsetTop);}}