oAjax = new XMLHttpObject();


function doSearch(string,url,key){
	if(string!=""){
		oP = document.createElement("p");
		oP.appendChild(document.createTextNode("Veuillez patienter jusqu'\u00E0 ce que la recherche se termine..."));
		drawSimple(oP);
		oAjax.open("GET","/_components/search_french/model/actBuildSearch.php?query="+string+"&strKey="+key+"&time"+Math.random());
		oAjax.onreadystatechange = function(){handleSearchResult(url)};
		oAjax.send(null);	
	}
}
function handleSearchResult(url){
	if(oAjax.readyState == 4){
		_closedraw();
		if(parseInt(oAjax.responseText) == 0){
			oP = document.createElement("p");
			oP.appendChild(document.createTextNode('Rien trouv\u00E9 qui corresponde \u00E0 vos crit\u00E8res.'));
			drawSimple(oP);
		}
		else{
			window.location.href = url+"/?action=show&lid=JXY1J-XG2K8-LGC1J&act=results&id="+oAjax.responseText;
		}
	}
}
function generalSearch(oForm,url,key){
	query = (typeof(oForm.childNodes[0].value) == "undefined") ? oForm.childNodes[1].value : oForm.childNodes[0].value;
	doSearch(query,url,key);
}// JavaScript Document
