var previousAuthorQuery = "";
var currentAuthorTimeout = 0;
var newAuthorQuery = "";
var section = 0;


function filterAuthorListing(queryString,sec) {
    if(queryString == previousAuthorQuery) return;
    previousAuthorQuery = queryString;

    var tURL = "AuthorFilter.php?section=" + sec + "&q=" + escape(queryString);
    
	jQuery.get(tURL, function(data){
		var resultElement = document.getElementById("writerlistwrapper");        
		resultElement.innerHTML = data;
	}); 
}

function performAuthorSearch() {
    currentAuthorTimeout = 0;
    filterAuthorListing(newAuthorQuery,section);
}

function delayedAuthorSearch(val,sec) {
	section = sec;
    newAuthorQuery = val;
    if(currentAuthorTimeout != 0) clearTimeout(currentAuthorTimeout);
    currentAuthorTimeout = setTimeout("performAuthorSearch()",500);
}

