var searchHttpRequest = smajax_createXMLHttpRequest();

function smajax_searchBoxModified(searchBlockId, searchBoxId, searchUrl)
{
	var value = document.getElementById(searchBoxId).value;
	if (value.length <= 2) {
		smajax_searchListHide(searchBlockId, 0);
		return true;
	}

	document.getElementById(searchBlockId).style.display="block";

	if( searchHttpRequest.readyState == 0 || searchHttpRequest.readyState == 4 )
	{
		try {
				searchHttpRequest.open('POST', searchUrl, true);
				searchHttpRequest.onreadystatechange= function () { smajax_loadResultTo(searchHttpRequest, searchBlockId);};
				searchHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
				var data = 'ajax=1&q=' + value;
				searchHttpRequest.send(data);
		}
		catch (e) {
			alert("Error calling XMLHttpRequest object");
			alert(e.message);
		}
	}
	return true;
}

function smajax_searchListHide(searchBlockId, timeOut) {
	if (timeOut == 0) document.getElementById(searchBlockId).style.display="none";
	else setTimeout("document.getElementById('" + searchBlockId + "').style.display=\"none\"", timeOut);

	return true;
}
