http://www.stadtmarketing-stadthagen.de/ function createXMLHttpRequest() { var req = null; try { req = new ActiveXObject("MSXML2.XMLHTTP"); } catch (err_MSXML2) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (err_Microsoft) { if (typeof XMLHttpRequest != "undefined") { req = new XMLHttpRequest; } } } return req; } var xml = createXMLHttpRequest(); function autoComplete(frm_field, part_id) { var div_holder = document.getElementById("search_autocomplete"); var field = document.getElementById(frm_field); if(field.value.length > 0) { xml.open("GET", "http://www.stadtmarketing-stadthagen.de/static/gsautocomplete.php?part_id="+part_id+"&pattern="+field.value, true); xml.onreadystatechange = function() { if(xml.readyState == 4) { render_suggestions(frm_field, xml.responseText); } } xml.send(null); } else { div_holder.style.display = "none"; } } function useSuggestion(frm_field, tag) { var div_holder = document.getElementById("search_autocomplete"); var field = document.getElementById(frm_field); field.value = tag.innerHTML; div_holder.style.display = "none"; } function render_suggestions(frm_field, response) { var div_holder = document.getElementById("search_autocomplete"); var div = document.getElementById("search_suggestions"); if(response.length > 0) { suggestions = response.split("_|_"); inner_html = ""; for(i=0;i"+suggestions[i]+""; } div_holder.style.display = "block"; div.innerHTML = inner_html; } else { div_holder.style.display = "none"; } }