function AjaxEnabled()
{
	
	var xmlHttp;

	try{
		
		
	//Opera 8.0+, Firefox, Safari, IE 7
	xmlHttp = new XMLHttpRequest();
	
	} catch (e){
		
		try{
			
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("ce site est incompatible avec votre navigateur");
				return false;
			}
		}
	}
	


	return xmlHttp;


}


function AjaxCall(action,array_query,callback,loading,xml){
	
	var _this = this;
	
	var _this = AjaxEnabled();

	var query_string = '';
	
	_ajaxLoadingContainer = document.getElementById('ajaxLoadingContainer');
	
	if(array_query != '' && array_query != null){
			
			for(i=0;i<array_query.length;i++) { 
			query_string += array_query[i]+'&'; 
			}
			
		}
		
	query_string = query_string.substring(0,query_string.length-1);
	
	if(loading === true){  
			
			if(_ajaxLoadingContainer != null){
				
				_ajaxLoadingContainer.style.display = 'block';
			
			}
		}
		
		_this.open("POST", HTTP_AJAX+action+'.php',true);
		
		_this.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); 
		
		_this.onreadystatechange = function() { 
		
			if(_this.readyState == 4 && _this.status == 200)  { 
		
				if(loading === true){
					
					
					if(_ajaxLoadingContainer != null){
					
						_ajaxLoadingContainer.style.display = 'none';
					
					}
				}
				
			
				if(xml === true){

					if( _this.responseXML.documentElement && callback != '' ){	
						
						callback(_this.responseXML);
					}
				
				}	else{
					
					if( _this.responseText != '' && callback != '' ){	
					
						callback(_this.responseText);
					}
					
				}
			
			} 
		
		}

		_this.send(query_string); 	
			
		
}

