17
if (null != global_timeout_id)
19
clearTimeout(global_timeout_id);
18
if (null != global_timeout_id)
20
clearTimeout(global_timeout_id);
21
22
global_timeout_id = setTimeout('$("q").fireEvent("search",$("q").value)',200);
25
26
search: function(query)
27
28
url = global_path + 'search?query=' + query;
29
30
if ($defined(global_search_request))
31
32
global_search_request.cancel();
33
global_search_request = new Request({'url':url,'method':'get','onComplete':cool_search});
34
global_search_request = new Request({'url':url,'method':'get','onComplete':function(response)
36
cool_search(response,query);
34
39
global_search_request.send('');
35
var posicion = search_box.getPosition();
36
var size = search_box.getSize();
40
var posicion = search_box.getPosition();
41
var size = search_box.getSize();
38
$('search_terms').setStyle('position','absolute');
39
$('search_terms').setStyle('left',posicion.x);
40
$('search_terms').setStyle('top',posicion.y + size.y);
41
$('search_terms').setStyle('display','block');
42
$('search_terms').set('html','Loading...');
43
$('search_terms').setStyle('position','absolute');
44
$('search_terms').setStyle('left',posicion.x);
45
$('search_terms').setStyle('top',posicion.y + size.y);
46
$('search_terms').setStyle('display','block');
47
$('search_terms').set('html','Loading...');
44
49
new Request({'url':url,'method':'get','onComplete':cool_search}).send('');
51
function cool_search(response)
56
function cool_search(response, query)
53
58
var posicion = $('q').getPosition();
54
59
var size = $('q').getSize();
55
$('search_terms').set('html',response);
56
$('search_terms').setStyle('display','block');
57
$('search_terms').setStyle('position','absolute');
58
$('search_terms').setStyle('left',posicion.x);
59
$('search_terms').setStyle('top',posicion.y + size.y);
60
var current_query = $('q').get('value');
61
if (current_query == query)
63
$('search_terms').set('html',response);
64
$('search_terms').setStyle('display','block');
65
$('search_terms').setStyle('position','absolute');
66
$('search_terms').setStyle('left',posicion.x);
67
$('search_terms').setStyle('top',posicion.y + size.y);
62
71
function hide_search()