var w="";
var pa=false;
var _oldInputFieldValue="";
var da=false;
var _currentInputFieldValue="";
var G="";
var _eventKeycode="";
var _highlightedSuggestionIndex=-1; // currently hightlighted suggestion index
var _highlightedSuggestionDiv=null; // currently highlisted suggestion div
var _completeDivRows=-1;            // completeDiv rows at time of keypress
var _completeDivDivList=null;       // completeDiv div list at time of keypress
var _completeDivRows2=5; 
var q="";
var _divTag="div"; 
var _spanTag="span"; 
var _documentForm=null; 
var _inputField=null; 
var _completeDiv=null; 
var _submitButton=null; 
var mb=null;
var X=null;
var _enString=null; // String "en"
var _cursorUpDownPressed=false;
var kc=null;
var hc=null;
var _resultCache=new Object(); // Cache of results
var Aa=1;
var Y=false;
var _lastKeyCode=-1; // Gets set on keyDown
var Va=(new Date()).getTime();
var _hasXMLHTTP=false; // Gets set to true if XMLHTTP Supported
var _xmlHttp=null; // This is the XMLHttp Object
var _completeSearchEnString=null; // Gets set to "/search/suggest/?hl=en"
var _completeSearchString=null;   // Gets set to "/search/suggest"
var B=null;
var aa=null;
var Ba=false;
var Ka=false;
var p=60;
var _searchString=null;   // Gets set to "suggest" in installAC() call.
var _timeoutAdjustment=0; // timeout adjustment
var ya=null;
var _search_host=null;

// Initiation function called from the page.
// InstallAC(document.f,document.f.q,document.f.btnG,"search","en");
// document.f is the name of the form on the page.
// document.f.q is the input text box on the page.
//  -> <input autocomplete="off" maxLength=256 size=55 name=q value="">
// document.f.btnG Search button
InstallAC=function(frm,fld,sb,pn,rl,h){
  _search_host=h;  
  if(!_search_host) {
    _search_host=document.domain;  
  }
  _documentForm=frm;
  _inputField=fld;
  _submitButton=sb;
  if(!pn) {
    pn="search";
  }
  _searchString=pn;
  var Kb="en|";
  var Jb="zh-CN|zh-TW|ja|ko|vi|";
  if(!rl||Kb.indexOf(rl+"|")==-1) {
    rl="en";
  }
  _enString=escapeURI(rl);
  if(Jb.indexOf(_enString+"|")==-1){
    // We won't pass through here.
    X=true;
    Y=false;
    Ba=false
  }else{
    // but will come through here.
    X=false;
    if(_enString.indexOf("zh")==0) {
      // not here.
      Y=false;
    } else {
      // but here.
      Y=true;
    }
    Ba=true
  }

   ya=false;
   w="query";
   mb=null;

  installACPartTwo()
}
;

// blurs focus, then sets focus again. 
// This is getting called when we press cursor up / cursor down.
function blurThenGetFocus(){
  _cursorUpDownPressed=true;
  _inputField.blur();
  setTimeout("setInputFieldFocus();",10);
  return
}

// setup a keydown event.
function setupKeydown1(){
  if(document.createEventObject) {
    var y=document.createEventObject();
    y.ctrlKey=true;
    y.keyCode=70;
    document.fireEvent("onkeydown",y)
  }
}

// setup a keydown event.
function setupKeydown2(vb){
  var y=document.createEventObject();
  y.ctrlKey=true;
  y.keyCode=vb;
  document.fireEvent("onkeydown",y)
}

function gc(event){}
function ic(event){}

function keyDownHandler(event){
  if(!event&&window.event) {
    event=window.event;
  }
  if(event) {
    _lastKeyCode=event.keyCode;
  }

  // We are backspacing here.
  if(event&&event.keyCode==8){
    if(X&&(_inputField.createTextRange&&(event.srcElement==a&&(bbI(_inputField)==0&&lbI(_inputField)==0)))){
      ccI(_inputField);
      event.cancelBubble=true;
      event.returnValue=false;
      return false
    }
  }
}

function mc(){}

// Called from InstallAC.
function installACPartTwo(){
  if(getXMLHTTP()){
    _hasXMLHTTP=true
  }else{
    _hasXMLHTTP=false
  }

  // pa init'd to false at the top of this file.
  if(pa) {
    _completeSearchString="suggest";
  } else {
    _completeSearchString="/suggest/"+_searchString;
  }

  _completeSearchEnString=_completeSearchString+"?hl="+_enString;

  if(!_hasXMLHTTP){
    setMyCookie("qu","",0,_completeSearchString,null,null)
  }

  _documentForm.onsubmit=Fa;
  _inputField.autocomplete="off";
  _inputField.onblur=onBlurHandler;

  if(_inputField.createTextRange) {
    _inputField.onkeyup=new Function("return okuh(event);");
  } else {
    _inputField.onkeyup=okuh;
  }

  _inputField.onsubmit=Fa;
  _currentInputFieldValue=_inputField.value;
  _oldInputFieldValue=_currentInputFieldValue;
  _completeDiv=document.createElement("DIV");
  _completeDiv.id="completeDiv";
  ca=1;
  Aa=1;
  _completeDiv.style.borderRight="#ccc "+ca+"px solid";
  _completeDiv.style.borderLeft="#ccc "+ca+"px solid";
  _completeDiv.style.borderTop="#ccc "+Aa+"px solid";
  _completeDiv.style.borderBottom="#ccc "+Aa+"px solid";
  _completeDiv.style.zIndex="1000";
  _completeDiv.style.paddingRight="0";
  _completeDiv.style.paddingLeft="0";
  _completeDiv.style.paddingTop="2px";
  _completeDiv.style.paddingBottom="5px";
  setCompleteDivSize(_completeDiv,_inputField);
  _completeDiv.style.visibility="hidden";
  _completeDiv.style.position="absolute";
  _completeDiv.style.backgroundColor="white";

  document.body.appendChild(_completeDiv);

  cacheResults("",new Array(),new Array());
  Gb(_completeDiv);
  var s=document.createElement("DIV");
  s.style.visibility="hidden";
  s.style.position="absolute";
  s.style.left="-10000";
  s.style.top="-10000";
  s.style.width="0";
  s.style.height="0";

  var M=document.createElement("IFRAME");
  M.completeDiv=_completeDiv;
  M.name="completionFrame";
  M.id="completionFrame";
  // opalka Do not call frame src.
  // M.src='http://' + _search_host + _completeSearchEnString;
  s.appendChild(M);
  document.body.appendChild(s);

  if(frames&&(frames["completionFrame"]&&frames["completionFrame"].frameElement)) {
    B=frames["completionFrame"].frameElement;
  } else {
    B=document.getElementById("completionFrame");
  }

  if(w=="url"){
    setInputFieldSize();
    setCompleteDivSize(_completeDiv,_inputField);
  }
  window.onresize=resizeHandler;
  document.onkeydown=keyDownHandler;
  setupKeydown1()
}

function onBlurHandler(event){
  if(!event&&window.event) {
    event=window.event;
  }
  if(!_cursorUpDownPressed){
    hideCompleteDiv();
    // check if tab pressed.
    if(_lastKeyCode==9){
      setSubmitButtonFocus();
      _lastKeyCode=-1
    }
  }
  _cursorUpDownPressed=false
}

okuh=function(e){
  _eventKeycode=e.keyCode;
  aa=_inputField.value;
  Oa()
}
;

function setSubmitButtonFocus(){
  _submitButton.focus()
}

setInputFieldFocus=function(){
  _inputField.focus()
}
;



// Return null if i undefined.
// otherwise return value of span cAutoComplete.
function valueOfCAutoComplete(i){
  if(!i) {
    return null;
  }
  return findSpanValueForClass(i,"cAutoComplete")
}

// Return null if i undefined.
// otherwise return value of span dAutoComplete.
function valueOfDAutoComplete(i){
  if(!i) {
    return null;
  }
  return findSpanValueForClass(i,"dAutoComplete")
}

function hideCompleteDiv(){
  document.getElementById("completeDiv").style.visibility="hidden"
}

function showCompleteDiv(){
  document.getElementById("completeDiv").style.visibility="visible";
  setCompleteDivSize(_completeDiv,_inputField);
}

// This is a result caching mechanism.
function cacheResults(is,cs,ds){
  _resultCache[is]=new Array(cs,ds)
}

// Return results.
// fr -> frameElement
// is -> searched query
// cs -> array of result strings
// ds -> array of result ids
// pr -> right now an empty array.
sendRPCDone=function(fr,is,cs,ds,pr){
  if(_timeoutAdjustment>0) {
    _timeoutAdjustment--;
  }
  var lc=(new Date()).getTime();
  if(!fr) {
    fr=B;
  }
  cacheResults(is,cs,ds);
  var b=fr.completeDiv;
  b.completeStrings=cs;
  b.displayStrings=ds;
  b.prefixStrings=pr;
  displaySuggestedList(b,b.completeStrings,b.displayStrings);
  Pa(b,valueOfCAutoComplete);
  if(_completeDivRows2>0) {
    b.height=16*_completeDivRows2+4;
  } else {
    hideCompleteDiv();
  }
}

// Event function Key down/up
function Oa(){
  //38 is up cursor key, 40 is down cursor key.
  //if(_eventKeycode==40||_eventKeycode==38) {
  //  blurThenGetFocus();
  //}

  var N=lbI(_inputField);
  var v=bbI(_inputField);
  var V=_inputField.value;

  if(X&&_eventKeycode!=0){
    if(N>0&&v!=-1) {
      V=V.substring(0,v);
    } 
    if(_eventKeycode==13||_eventKeycode==3){ 
      var d=_inputField; 
      if(d.createTextRange){
        var t=d.createTextRange();
        t.moveStart("character",d.value.length);
        t.select()
      } else if (d.setSelectionRange){
        d.setSelectionRange(d.value.length,d.value.length)
      }
    } else { 
      if(_inputField.value!=V) {
        selectEntry(V)
      }
    }
  }
  _currentInputFieldValue=V;
  if(handleCursorUpDownEnter(_eventKeycode)&&_eventKeycode!=0) { 
    Pa(_completeDiv,valueOfCAutoComplete)
  }
}

function Fa(){
  return xb(w)
}

function xb(eb) {
  da=true;

  if(!_hasXMLHTTP){
    setMyCookie("qu","",0,_completeSearchString,null,null)
  }

  hideCompleteDiv();
  if(eb=="url"){
    var R="";
    if(_highlightedSuggestionIndex!=-1&&h) {
      R=valueOfCAutoComplete(_highlightedSuggestionDiv);
    }
    if(R=="") {
      R=_inputField.value;
    }
    if(q=="") { 
      document.title=R;
    } else {
      document.title=q;
    }
    var Tb="window.frames['"+mb+"'].location = \""+R+'";';
    setTimeout(Tb,10);
    return false

  } else if(eb=="query"){
    document.getElementById("place_id").value=q;
    _documentForm.submit();
    return true
  }
}

newwin=function(){
  window.open(_inputField.value);
  hideCompleteDiv();
  return false
}
;

idkc=function(e){
  if(Ba){
    var Ta=_inputField.value;
    if(Ta!=aa){
      _eventKeycode=0;
      Oa()
    }
    aa=Ta;
    setTimeout("idkc()",10)
  }
}
;
setTimeout("idkc()",10);

// Go read about encodeURIComponent here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsmthencodeuricomponent.asp
// Basically converts a string to a valid uri. (spaces become %20, etc, etc..)
// this function was nb.
function escapeURI(La){
  if(encodeURIComponent) {
    return encodeURIComponent(La);
  }
  if(escape) {
    return escape(La)
  }
}

// If Mb is 0, will return 150.
// If Mb is 3, will return 250.
// If Mb is 4, will return 450.
// If Mb is X, will return 850.
function recalculateTimeout(Mb){
  var H=100;
  for(var o=1; o<=(Mb-2)/2; o++){
    H=H*2
  }
  H=H+50;
  return H
}

// This function sets itself up and gets called over and over (timeout driven)
mainLoop=function(){
  if(_oldInputFieldValue!=_currentInputFieldValue){
    if(!da){
      var Za=escapeURI(_currentInputFieldValue);
      var ma=_resultCache[_currentInputFieldValue];

      if(ma){
        // Found in our cache.
        Va=-1;
        sendRPCDone(B,_currentInputFieldValue,ma[0],ma[1],B.completeDiv.prefixStrings)

      }else{
        _timeoutAdjustment++;
        Va=(new Date()).getTime();
        if(_hasXMLHTTP){
            callHome(Za)
        } else {
          setMyCookie("qu",Za,null,_completeSearchString,null,null);
          frames["completionFrame"].document.location.reload(true)
        }
      }
      _inputField.focus()
    }
    da=false
  }
  _oldInputFieldValue=_currentInputFieldValue;
  setTimeout("mainLoop()",recalculateTimeout(_timeoutAdjustment));
  return true
}
;

// Call mainLoop() after 10 milliseconds.
setTimeout("mainLoop()",10);

// This is onMouseDown function.
var Cb=function(){
  selectEntry(valueOfCAutoComplete(this));
  q=valueOfDAutoComplete(this);
  da=true;
  Fa()
}
;

// On mouseover.
var pb=function(){
  if(_highlightedSuggestionDiv) {
    setStyleForElement(_highlightedSuggestionDiv,"aAutoComplete");
  }
  setStyleForElement(this,"bAutoComplete")
}
;

// On Mouse out.
var ec=function(){
  setStyleForElement(this,"aAutoComplete")
}
;

// Called when cursor up/down pressed selects new entry in completeDiv.
function highlightNewValue(C){
  _currentInputFieldValue=G;
  selectEntry(G);
  q=G;
  if(!_completeDivDivList||_completeDivRows<=0) {
    return;
  }
  showCompleteDiv();
  if(C>=_completeDivRows){
    C=_completeDivRows-1
  }
  if(_highlightedSuggestionIndex!=-1&&C!=_highlightedSuggestionIndex){
    setStyleForElement(_highlightedSuggestionDiv,"aAutoComplete"); 
    _highlightedSuggestionIndex=-1
  }
  if(C<0){
    _highlightedSuggestionIndex=-1;
    _inputField.focus();
    return
  }
  _highlightedSuggestionIndex=C;
  _highlightedSuggestionDiv=_completeDivDivList.item(C);
  setStyleForElement(_highlightedSuggestionDiv,"bAutoComplete");
  _currentInputFieldValue=G;
  q=valueOfDAutoComplete(_highlightedSuggestionDiv);
  selectEntry(valueOfCAutoComplete(_highlightedSuggestionDiv))
}

// returns false if cursor up / cursor down or enter pressed.
function handleCursorUpDownEnter(eventCode){
  if(eventCode==40){
    highlightNewValue(_highlightedSuggestionIndex+1);
    return false
  }else if(eventCode==38){
    highlightNewValue(_highlightedSuggestionIndex-1);
    return false
  }else if(eventCode==13||eventCode==3){
    return false
  }
  return true
}

// Pa(completeDiv,H)
// This function gets called for every keypress I make.
function Pa(localCompleteDiv,ib){
  var localInputField=_inputField;
  var T=false;
  _highlightedSuggestionIndex=-1;

  // This becomes the rows in our suggestion list.
  var J=localCompleteDiv.getElementsByTagName(_divTag);

  // # of rows in list.
  var O=J.length;
  _completeDivRows=O;
  _completeDivDivList=J;
  _completeDivRows2=O;
  G=_currentInputFieldValue;
  if(_currentInputFieldValue==""||O==0){
    hideCompleteDiv()
  }else{
    showCompleteDiv()
  }

  var Ab="";
  if(_currentInputFieldValue.length>0){
    var f;
    var o;
    // My prefixStrings was always an empty array.
    // So local variable T never would be set to true.
    // And the local variable Ab would remain empty.
    for(var f=0; f<O; f++){
      for(o=0; o<localCompleteDiv.prefixStrings.length; o++){
        var Ib=localCompleteDiv.prefixStrings[o]+_currentInputFieldValue;
        if(Y||ib(J.item(f)).toUpperCase().indexOf(Ib.toUpperCase())==0) {
          Ab=localCompleteDiv.prefixStrings[o]; 
          T=true; 
          break
        }
      }
      if(T){
        break
      }
    }
  }
  if(T) {
    _highlightedSuggestionIndex=f;
  }
  for(var f=0; f<O; f++) {
    setStyleForElement(J.item(f),"aAutoComplete");
  }
//  if(T){
//    _highlightedSuggestionDiv=J.item(_highlightedSuggestionIndex);
//    q=valueOfDAutoComplete(_highlightedSuggestionDiv)
//  }else{
    q=_currentInputFieldValue;
    _highlightedSuggestionIndex=-1;
    _highlightedSuggestionDiv=null
//  }
  var ab=false;
  switch(_eventKeycode){
    // cursor left, cursor right, others??
    case 8:
    case 33:
    case 34:
    case 35:
    case 35:
    case 36:
    case 37:
    case 39:
    case 45:
    case 46:
      ab=true;
      break;
    default:
      // regular keypress .
      break
  }
  //alert("ab: " + ab);
  if(!ab&&_highlightedSuggestionDiv){
    var Da=_currentInputFieldValue;
    setStyleForElement(_highlightedSuggestionDiv,"bAutoComplete");
    var z;
    if(T) {
      z=ib(_highlightedSuggestionDiv).substr(localCompleteDiv.prefixStrings[o].length);
    } else {
      z=Da;
    }
    if(z!=localInputField.value){
      if(localInputField.value!=_currentInputFieldValue) {
        return;
      }
      if(X){
        if(localInputField.createTextRange||localInputField.setSelectionRange) {
          selectEntry(z);
        }
        if(localInputField.createTextRange){
          var t=localInputField.createTextRange();
          t.moveStart("character",Da.length);
          t.select()
        }else if(localInputField.setSelectionRange){
          localInputField.setSelectionRange(Da.length,localInputField.value.length)
        }
      }
    }
  }else{
    _highlightedSuggestionIndex=-1;
    q=_currentInputFieldValue
  }
}
function setMyCookie(name,value,Ra,hb,fb,Sb){
  // opalka;
  // return;

  var Nb=name+"="+value+(Ra?";expires="+Ra.toGMTString():"")+(hb?";path="+hb:"")+(fb?";domain="+fb:"")+(Sb?";secure":"");
  document.cookie=Nb
}

// Was Ha
function setInputFieldSize(){
  var xa=document.body.scrollWidth-220;
  xa=0.73*xa;
  _inputField.size=Math.floor(xa/6.18)
}

function jc(Zb,Ea){
  if(!Ea)Ea=1;
  if(pa&&pa<=Ea){
    var Ia=document.createElement("DIV");
    Ia.innerHTML=Zb;
    document.getElementById("console").appendChild(Ia)
  }
}

function setStyleForElement(c,name){
  db();
  c.className=name;
  if(Ka){
    return
  }
  switch(name.charAt(0)){
    case "m":
      c.style.marginTop="2px";
      c.style.fontSize="13px";
      c.style.fontFamily="arial,sans-serif";
      c.style.wordWrap="break-word";
      break;
    case "l":
      c.style.display="block";
      c.style.paddingLeft="3px";
      c.style.paddingRight="3px";
      c.style.height="16px";
      c.style.overflow="hidden";
      break;
    case "a":
      c.style.backgroundColor="white";
      break;
    case "b":
      c.style.backgroundColor="#D7E1E8";
      //if(c.displaySpan){
      //  // opalka hover text color of element on the right.
      //  c.displaySpan.style.color="#3366cc" 
      //}
      break;
    case "c":
      //c.style.width=p+"%";
      c.style.cssFloat="left";
      c.style.paddingLeft="3px";
      break;
    case "i":
      c.style.color="#333";
      c.style.fontSize="11px";
      // c.style.paddingLeft="5px";
      break;
    case "d":
      c.style.display="none";
      c.style.cssFloat="right";
      //c.style.width=100-p+"%";
      if(w=="query"){
        c.style.fontSize="10px";
        c.style.textAlign="right";
        c.style.color="white";
        c.style.paddingTop="3px"
      }else{
        c.style.color="#696969"
      }
      break
  }
}

function db(){
  p=65;
  if(w=="query"){
    var wb=110;
    var Sa=calculateWidth(_inputField);
    var tb=(Sa-wb)/Sa*100;
    p=tb
  }else{
    p=65
  }
  if(ya){
    p=99.99
  }
}
function Gb(i){
  db();
  var Ub="font-size: 13px; font-family: arial,sans-serif; word-wrap:break-word; ";
  var Vb="display: block; padding-left: 3; padding-right: 3; height: 16px; overflow: hidden; ";
  var bc="background-color: white; ";
  var qb="background-color: #3366cc; color: white ! important; ";
  var ub="display: block; margin-left: 0%; width: "+p+"%; float: left; ";
  var Ga="display: block; margin-left: "+p+"%; ";
  if(w=="query"){
    Ga+="font-size: 10px; text-align: right; color: green; padding-top: 3px; "
  }else{
    Ga+="color: #696969; "
  }
  D(".mAutoComplete",Ub);
  D(".lAutoComplete",Vb);
  D(".aAutoComplete *",bc);
  D(".bAutoComplete *",qb);
  D(".cAutoComplete",ub);
  D(".dAutoComplete",Ga);
  setStyleForElement(i,"mAutoComplete")
}

// Called from sendRPCResponse.
// i = fr.completeDiv
// cs = list of results from first array.
// Hb = list of results from second array.
function displaySuggestedList(i,cs,Hb){

  while(i.childNodes.length>0) {
    i.removeChild(i.childNodes[0]);
  }

  // For each element in our list, we create:
  // <DIV (u) - mousedown/mouseover/mouseout aAutoComplete>
  //   <SPAN (ka) lAutoComplete>
  //     <SPAN (ua) cAutoComplete>
  //        bug tracking
  //     </SPAN (ua)>
  //     <SPAN (ea) dAutoComplete>
  //        500,000 results
  //     </SPAN (ea)>
  //   </SPAN>
  // </DIV (u)>
  for(var f=0; f<cs.length; ++f){
    var u=document.createElement("DIV");

    setStyleForElement(u,"aAutoComplete");
    u.onmousedown=Cb;
    u.onmouseover=pb;
    u.onmouseout=ec;

    var ka=document.createElement("SPAN");
    setStyleForElement(ka,"lAutoComplete");

    var ua=document.createElement("SPAN");
    ua.innerHTML=cs[f].replace(/&/g,'and'); // Suggested result.

    var ea=document.createElement("SPAN");
    setStyleForElement(ea,"dAutoComplete"); // str on the far right.
    setStyleForElement(ua,"cAutoComplete");
    u.displaySpan=ea;

    var p_id = null;
    var p_c  = null;
    if(!ya) {
      // Text from 2nd result array.
      // 106707:USA
      var ma = Hb[f].split(':');
      p_id = ma[0];
      p_c  = ma[1];
      ea.innerHTML=p_id; // the text from 2nd result array.
    }

    var iv=document.createElement("SPAN");
    setStyleForElement(iv,"iAutoComplete");
    if(p_c) {
      iv.innerHTML=', ' + p_c; // context str after suggested place.
    } else {
      iv.innerHTML='&nbsp;';
    }

    ka.appendChild(ua);
    ka.appendChild(iv);
    ka.appendChild(ea);
    u.appendChild(ka);
    i.appendChild(u)
  }
}

function D(name,gb){
  if(Ka){
    var I=document.styleSheets[0];
    if(I.addRule){
      I.addRule(name,gb)
    }else if(I.insertRule){
      I.insertRule(name+" { "+gb+" }",I.cssRules.length)
    }
  }
}



function getDataFromServer(q) {
    var id  = 'ScriptTagID';
    var url = 'http://' + _search_host;

    // Use this element to get data.
    oScript = document.getElementById(id);
    
    // Point at the script tag, if it exists.
    var head = document.getElementsByTagName("head").item(0);
    
    // Destroy the tag, if it exists.
    if (oScript) {
        head.removeChild(oScript);
    }
    
    // Create the new script tag
    oScript = document.createElement("script");
    
    // Setup the src attribute of the script tag.
    wholeurl = url + _completeSearchEnString + "&qu=" + q;
    oScript.setAttribute("src", wholeurl);
    
    // Set the id attribute of the script tag.
    oScript.setAttribute("id",id);
    
    // Create new script tag which causes the proxy to be called.
    head.appendChild(oScript);
}

function callHome(Rb){
  // For now, do not use AJAX call. opalka.
  getDataFromServer(Rb);
  return;

  if(_xmlHttp && _xmlHttp.readyState!=0){
    _xmlHttp.abort()
  }

  _xmlHttp=getXMLHTTP();

  if(_xmlHttp){
    _xmlHttp.open("GET",_completeSearchEnString + "&qu=" + Rb, true);

    // Note that this function will ONLY be called when we get a complete response.
    _xmlHttp.onreadystatechange=function() {

    if(_xmlHttp.readyState==4&&_xmlHttp.responseText) {
        var frameElement=B;
        if(_xmlHttp.responseText.charAt(0)=="<"){
          _timeoutAdjustment--

        }else{
          // The response text gets executed as javascript. 
          eval(_xmlHttp.responseText)
        }
      }
    }
    ;
    _xmlHttp.send(null)
  }
}

// Select suggested entry.
// wa is the value to set the inputfield to.
function selectEntry(Wa){
  _inputField.value=Wa;
  aa=Wa
}

