
function getHTTPObject()
{
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (E) {
        xmlhttp = false;
        }
      }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
      } catch (e) {
      xmlhttp = false;
      }
    }
  return xmlhttp;
}

var xhr = getHTTPObject();

	

function isAjaxCompatible()
{
	if(!xhr)
	{
		alert("Votre navigateur est trop ancien est ne supporte pas l'ajax");	
		return false;
	}

	return true;
}


function ajaxIt(method, url, asynchrone, data, hook, objParentId)
{
	if(!isAjaxCompatible())return false;

	
	// on lance le loader
	if(!empty(objParentId))
	{
		
		objParentId.style.position = 'absolute';
		$X('ajax_loader').style.left = objParentId.offsetLeft+'px';
		$X('ajax_loader').style.top = objParentId.offsetTop+'px';
		objParentId.style.position = '';
		$X('ajax_loader').style.width = objParentId.offsetWidth+'px';
		$X('ajax_loader').style.height = objParentId.offsetHeight+'px';
		$X('ajax_loader').style.visibility = 'visible';
	}
	
	xhr.open(method, url, asynchrone);
	xhr.setRequestHeader('Content-Type', 'charset=iso-8859-1');
		
	xhr.onreadystatechange = function() {
		if(xhr.readyState == 4)
		{
			if(!empty(xhr.responseText))
			{
				//alert(xhr.responseText);
				eval(xhr.responseText);
				
				// on recharge les noeud js
				
				
				// on cache le loader
				if(!empty(objParentId))
				{
					$X('ajax_loader').style.visibility = 'hidden';
				}
			}
			
			// hook ?
			if(!empty(hook))
				eval(hook);
		}
	}
	xhr.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
	xhr.send(data);
}


