1 // remote scripting library
2 // (c) copyright 2005 modernmethod, inc
10 // Remove the typing barrier to allow call() to complete
11 function Search_doneTyping()
16 // Wait 500ms to run call()
17 function Searching_Go()
19 setTimeout("Searching_Call()", 500);
22 // If the user is typing wait until they are done.
23 function Search_Typing() {
26 setTimeout("Search_doneTyping()", 500);
28 // I believe these are needed by IE for when the users press return?
31 if (event
.keyCode
== 13)
33 event
.cancelBubble
= true;
34 event
.returnValue
= true;
39 // Set the body div to the results
40 function Searching_SetResult( request
)
42 if ( request
.status
!= 200 ) {
43 alert("Error: " + request
.status
+ " " + request
.statusText
+ ": " + request
.responseText
);
47 var result
= request
.responseText
;
49 //body.innerHTML = result;
50 t
= document
.getElementById("searchTarget");
52 oldbody
=body
.innerHTML
;
53 body
.innerHTML
= '<div id="searchTargetContainer"><div id="searchTarget" ></div></div>' ;
54 t
= document
.getElementById("searchTarget");
57 t
.style
.display
='block';
60 function Searching_Hide_Results()
62 t
= document
.getElementById("searchTarget");
63 t
.style
.display
='none';
64 body
.innerHTML
= oldbody
;
68 // This will call the php function that will eventually
69 // return a results table
70 function Searching_Call()
75 //Don't proceed if user is typing
79 x
= document
.getElementById("searchInput").value
;
81 // Don't search again if the query is the same
87 // Don't search for blank or < 3 chars.
88 if ((x
=="") || (x
.length
< 3))
93 sajax_do_call( "wfSajaxSearch", [ x
], Searching_SetResult
);
98 function sajax_onload() {
99 x
= document
.getElementById( 'searchInput' );
100 x
.onkeypress= function() { Search_Typing(); };
102 body
= document
.getElementById("content");