2 var useAjax = (document.location.protocol.toLowerCase() == 'http:');
3 var isLocal = !useAjax;
5 var previous_search = "";
7 function erzXMLHttpRequestObject ()
11 resObject = new XMLHttpRequest ();
15 resObject = new ActiveXObject ("Microsoft.XMLHTTP");
19 resObject = new ActiveXObject ("MSXML2.XMLHTTP");
22 alert ("Unable to create XMLHttpRequest object for the search function!");
30 function searchResult (language, manual, bigpage)
32 search_string = this.document.search_form.q.value;
33 if (useAjax && previous_search != search_string) {
34 if (useAjax && search_string.length >= 3) {
39 resObject.open ('get', reldir + 'lily_index_search.php?lang=' + escape(language) + '&manual=' + escape(manual) + '&bigpage=' + bigpage + '&q=' + escape(search_string), true);
40 resObject.onreadystatechange = handleResponse;
41 resObject.send (null);
45 previous_search = search_string;
49 function result_field ()
51 return document.getElementById ('search_results');
53 function assignResults (results)
55 field = result_field ();
56 field.innerHTML = resObject.responseText;
57 field.style.display = 'block';
60 function handleResponse ()
62 if (resObject.readyState == 4 ) {
63 assignResults (resObject.responseText);
67 function clearResults ()
69 field = result_field ();
71 field.style.display = 'none';
75 function print_search_field (language, manual, bigpage)
78 // If the user presses enter and submits the form, also call the search
79 // script to print out the results in a separate page
80 search_call = "searchResult('" + language + "', '" + manual + "', " + bigpage + ")";
85 search_script = reldir + 'lily_index_search.php';
86 document.write("<div id=\"search\">");
87 document.write("<form name=\"search_form\" action=\"" + search_script + "\" onsubmit=\"" + search_call + "; return false;\">");
88 document.write("<input type=\"hidden\" name=\"lang\" value=\"" + escape(language) + "\" >");
89 document.write("<input type=\"hidden\" name=\"manual\" value=\"" + escape(manual) + "\" >");
90 document.write("<input type=\"hidden\" name=\"bigpage\" value=\"" + bigpage + "\" >");
91 document.write("<input type=\"hidden\" name=\"form_submitted\" value=\"1\" >");
92 document.write("<p class=\"searchbar\">Search: ");
93 document.write(" <input name=\"q\" onkeyup=\"" + search_call + "\" size=25></input></p>");
94 document.write(" <div id=\"search_results\"></div>");
95 document.write("</form>");
96 document.write("</div>");
100 resObject = erzXMLHttpRequestObject ();