var httpReponse = '';

function	ajax(nameScript,data,nameFunction)
{
	if(document.getElementById('loaderAjax'))
		document.getElementById('loaderAjax').src  = '../images/recherche/ajaxLoader.gif';
	var xhr_object	= null;
	
	if(window.XMLHttpRequest)		// Firefox 
		xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) 	// Internet Explorer 
	      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	if (xhr_object != null)
	{
		xhr_object.open("POST", nameScript, true);
		if (nameFunction != '')
		{
			//alert(nameScript+'-'+data+'-'+nameFunction);
			xhr_object.onreadystatechange = function()
			{ 
				if(xhr_object.readyState == 4)
				{
					httpReponse = xhr_object.responseText;
					eval(nameFunction + '();')
				}
			}
		}
		xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xhr_object.send(data);
	}
	else
		nameFunction('noAjax');
}

function execAjax()
{
	//alert(unescape(unescape(httpReponse)));
	//document.write(unescape(httpReponse));
	
	
	if(httpReponse && httpReponse != '' && httpReponse != undefined)
		eval(unescape(httpReponse));
	if(document.getElementById('loaderAjax'))
		document.getElementById('loaderAjax').src  = '../images/x.gif';
}

function show(val,id)
{
	if(document.getElementById(id))
		obj = top.document.getElementById(id).innerHTML = unescape(val);
}
