blob: 09516b306bdf9cb149fa99bb8f9b12d13738646d (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
var resObject = null;
var useAjax = (document.location.protocol.toLowerCase() == 'http:');
var isLocal = !useAjax;
var previous_search = "";
function erzXMLHttpRequestObject ()
{
var resObject = null;
try {
resObject = new XMLHttpRequest ();
}
catch (Error) {
try {
resObject = new ActiveXObject ("Microsoft.XMLHTTP");
}
catch (Error) {
try {
resObject = new ActiveXObject ("MSXML2.XMLHTTP");
}
catch (Error) {
alert ("Unable to create XMLHttpRequest object for the search function!");
useAjax = false;
}
}
}
return resObject;
}
function searchResult (language, manual, bigpage)
{
search_string = this.document.search_form.q.value;
if (useAjax && previous_search != search_string) {
if (useAjax && search_string.length >= 3) {
var reldir = "";
if (bigpage == 0) {
reldir = "../"
}
resObject.open ('get', reldir + 'lily_index_search.php?lang=' + escape(language) + '&manual=' + escape(manual) + '&bigpage=' + bigpage + '&q=' + escape(search_string), true);
resObject.onreadystatechange = handleResponse;
resObject.send (null);
} else {
clearResults ();
}
previous_search = search_string;
}
}
function result_field ()
{
return document.getElementById ('search_results');
}
function assignResults (results)
{
field = result_field ();
field.innerHTML = resObject.responseText;
field.style.display = 'block';
}
function handleResponse ()
{
if (resObject.readyState == 4 ) {
assignResults (resObject.responseText);
}
}
function clearResults ()
{
field = result_field ();
field.innerHTML = 0;
field.style.display = 'none';
}
function print_search_field (language, manual, bigpage)
{
if (useAjax) {
// If the user presses enter and submits the form, also call the search
// script to print out the results in a separate page
search_call = "searchResult('" + language + "', '" + manual + "', " + bigpage + ")";
var reldir = "";
if (bigpage == 0) {
reldir = "../"
}
search_script = reldir + 'lily_index_search.php';
document.write("<div id=\"search\">");
document.write("<form name=\"search_form\" action=\"" + search_script + "\" onsubmit=\"" + search_call + "; return false;\">");
document.write("<input type=\"hidden\" name=\"lang\" value=\"" + escape(language) + "\" >");
document.write("<input type=\"hidden\" name=\"manual\" value=\"" + escape(manual) + "\" >");
document.write("<input type=\"hidden\" name=\"bigpage\" value=\"" + bigpage + "\" >");
document.write("<input type=\"hidden\" name=\"form_submitted\" value=\"1\" >");
document.write("<p class=\"searchbar\">Search: ");
document.write(" <input name=\"q\" onkeyup=\"" + search_call + "\" size=25></input></p>");
document.write(" <div id=\"search_results\"></div>");
document.write("</form>");
document.write("</div>");
}
}
if (useAjax) {
resObject = erzXMLHttpRequestObject ();
}
|