 # It does not necessarily fire off an AJAX request if the last one was just a
 # little time ago.
 formChanged = ->
-	console.debug 'formChanged()'
 	newQuery = $(this).val()
 
 	if newQuery == currentQuery
-		console.debug 'formChanged(): Query did not change, abort.'
 		return
 
 	currentQuery = newQuery

# Hides the result pane. When the animation is done, the ``animationDone()``
# will be called.
hideResultPane = ->
	console.debug 'hideResultPane()'
	if $('#search_result_pane').length > 0
		animationActive = true
		$('#search_result_pane').slideUp(animationTime, animationDone)

# Inserts the current data into the results pane and slides it down.
updateResultPane = ->
	console.debug('updateResultPane()')

	if ajaxActive || animationActive
		console.debug('updateResultPane(): Quitting since active.')
		return

	if currentData is null
		console.debug('updateResultPane(): currentData is null')
		return

	initResultPane()

#
# @param data Search results from the server.
querySuccess = (data, textStatus, jqXHR) ->
	ajaxActive = false
	currentData = data
	updateResultPane()

ajaxError = (data, textStatus, jqXHR) ->
	ajaxActive = false

# Initializes the result pane, creates it if needed.
initResultPane = ->
	if $('#search_result_pane').length == 0
		$('#search').append('<div id="search_result_pane"></div>')
		$('#search_result_pane').slideUp(0)
