/*AJAX FONCTIONS*/
//AJAX
var httpReponse = '';

function	ajax(nameScript,data,nameFunction)
{
	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);
					
		xhr_object.onreadystatechange = function()
		{ 
		
			if(xhr_object.readyState == 4)
			{		
				httpReponse = xhr_object.responseText;
				if(nameFunction != '') eval(nameFunction +';')
			}
		}
		xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xhr_object.send(data);
	}
	else
		nameFunction('noAjax');
}

function actionDOM(){
	//alert(httpReponse);
	//alert(unescape(unescape(httpReponse)));
	eval(unescape(httpReponse));
	//document.getElementById('contenu').innerHTML = unescape(httpReponse);
}

function getCont(action,critere)
{
	//alert('php/ajaxCont.php?action='+action+'&'+critere,'actionDOM()');
	path		=	'';
	if(location.href.indexOf('.htm') != -1)
		path 	= 	'../';
	ajax(path+'php/ajaxCont.php','action='+escape(action)+'&'+critere,'actionDOM()');
}

function show(obj,val)
{
	//alert(escape(val));
	document.getElementById(obj).innerHTML = unescape(val);
}

function applyCSS(obj,classe)
{
	//document.getElementById(obj).style.backgroundColor = classe;
	document.getElementById(obj).setAttribute("class",classe);
	document.getElementById(obj).setAttribute("className",classe);
}

