 
 # Checks whether another AJAX request can be performed. Otherwise this
 # function will wait and call itself again.
-waitToQuery = () ->
+waitToQuery = ->
 	console.debug 'waitToQuery()'
 
 	if isAjaxActive()

lastChange = 0

# Initializes the search.
searchMain = () ->
	showField()
	attachListener()

# Checks whether there is an AJAX request pending.
isAjaxActive = () ->
	console.debug "isAjaxActive()"
	now = new Date().getTime()
	if now - lastAjax > ajaxTimeout

		setTimeout waitToQuery, toWait

# Performs the actual AJAX request and queries the database.
performQuery = ->
	console.debug 'perfomQuery()'
	ajaxActive = true
	lastAjax = new Date().getTime()
