var req;


function search_input(el)
{
// 	alert(el.value);
  suchwort = el.value;
    
  if (suchwort.length > 1)
  {
    url = "ermittleAdressen.html?suche=" + suchwort;
    if (window.XMLHttpRequest) 
    {
      req = new XMLHttpRequest();
      req.onreadystatechange = search_process;
      req.open("GET", url, true);
      req.send(null);
    }
    else if (window.ActiveXObject) 
    {
      req = new ActiveXObject("Microsoft.XMLHTTP");
      if (req) 
      {
     	req.onreadystatechange = search_process;
        req.open("GET", url, true);
        req.send();
      }
    }
  }
}


function search_process()
{
	if (req.readyState == 4)
	{
		if (req.status == 200)
		{
			el = document.getElementById("suchergebnis");
			el.innerHTML = req.responseText;
			el.style.display = "block";
		}
	}
}

function URLDecode (encodedString) {
  var output = encodedString;
  var binVal, thisString;
  var myregexp = /(%[^%]{2})/;
  output = output.replace(/\+/g, " ");
  while ((match = myregexp.exec(output)) != null
             && match.length > 1
             && match[1] != '') {
    binVal = parseInt(match[1].substr(1),16);
    thisString = String.fromCharCode(binVal);
    output = output.replace(match[1], thisString);
  }
  return output;
}


