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 window
.status
= "Waiting until you're done typing...";
27 setTimeout("Search_doneTyping()", 500);
29 // I believe these are needed by IE for when the users press return?
32 if (event
.keyCode
== 13)
34 event
.cancelBubble
= true;
35 event
.returnValue
= false;
40 // Set the body div to the results
41 function Searching_SetResult( request
)
43 if ( request
.status
!= 200 ) {
44 alert("Error: " + request
.status
+ " " + request
.statusText
+ ": " + request
.responseText
);
48 var result
= request
.responseText
;
50 //body.innerHTML = result;
51 t
= document
.getElementById("searchTarget");
53 oldbody
=body
.innerHTML
;
54 body
.innerHTML
= '<div id="searchTargetContainer"><div id="searchTarget" ></div></div>' ;
55 t
= document
.getElementById("searchTarget");
58 t
.style
.display
='block';
61 function Searching_Hide_Results()
63 t
= document
.getElementById("searchTarget");
64 t
.style
.display
='none';
65 body
.innerHTML
= oldbody
;
69 // This will call the php function that will eventually
70 // return a results table
71 function Searching_Call()
76 //Don't proceed if user is typing
80 x
= document
.getElementById("searchInput").value
;
82 // Don't search again if the query is the same
88 // Don't search for blank or < 3 chars.
89 if ((x
=="") || (x
.length
< 3))
94 sajax_do_call( "wfSajaxSearch", [ x
], Searching_SetResult
);
99 function sajax_onload() {
100 x
= document
.getElementById( 'searchInput' );
101 x
.onkeypress= function() { Search_Typing(); };
103 body
= document
.getElementById("content");