 # Checks whether another AJAX request can be performed. Otherwise this
 # function will wait and call itself again.
 waitToQuery = ->
-	console.debug 'waitToQuery()'
-
 	if isAjaxActive()
-		console.debug 'waitToQuery(): AJAX still active, abort.'
 		return
 
 	now = new Date().getTime()
 	elapsed = now - lastChange
 
 	if (elapsed > idleTime)
-		console.debug 'waitToQuery(): Performing update.'
 		hideResultPane()
 		performQuery()
 	else
 		toWait = idleTime - elapsed
-		console.debug 'waitToQuery(): Still have to wait '+toWait+'.'
 		setTimeout waitToQuery, toWait
 
 # Performs the actual AJAX request and queries the database.
 performQuery = ->
-	console.debug 'perfomQuery()'
 	ajaxActive = true
 	lastAjax = new Date().getTime()
 	$.ajax({


# Moves the selection up one step.
moveUp = ->
	console.debug('moveUp()')
	moveSelection(-1)

# Moves the selection down one step.
moveDown = ->
	console.debug('moveDown()')
	moveSelection(1)

# Moves the selection the given steps.
#
# @param steps Positive or negative step number.
moveSelection = (steps) ->
	console.debug('moveSelection()')
	entries = $('li.search_entry')
	console.debug(entries)
	entryCount = entries.length
	newSelection = currentSelection + steps
	if 0 <= newSelection < entryCount

# It does not necessarily fire off an AJAX request if the last one was just a
# little time ago.
formChanged = ->
	newQuery = $(this).val()

	if newQuery == currentQuery
		return

	currentQuery = newQuery
