// On définit le XHR d'une nouvelle méthode pour permettre d'appliquer plusieurs requêtes AJAX en même temps
pickRecentProgID = function (idList){
	// found progID flag
    var bFound = false;
    for(var i=0; i < idList.length && !bFound; i++){
        try{
            var oDoc = new ActiveXObject(idList[i]);
            o2Store = idList[i];
            bFound = true;
        }catch (objException){
            // trap; try next progID
        };
    };
    if (!bFound)
        throw "Could not retreive a valid progID of Class";
    idList = null;
    return o2Store;
}

GetXmlHttpRequest_AXO=null

GetXmlHttpRequest=function () {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest()
	}
	else if (window.ActiveXObject) {
		if (!GetXmlHttpRequest_AXO) {
			GetXmlHttpRequest_AXO=pickRecentProgID(["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]);
		}
		return new ActiveXObject(GetXmlHttpRequest_AXO)
	}
	return false;
}

getXhr = GetXmlHttpRequest;

// == On créé une fonction ajax pour déterminer la résolution de l'écran de l'internaute pour ouvrir des fenêtre modale adaptée à sa résolution si on le souhaite
function determinerResolutionEcran(){
	var xhr = getXhr();

	var largeurResolution = 0, hauteurResolution = 0;  
	if( typeof( window.innerWidth ) == 'number' ) {  
		//Non-IE  
		largeurResolution = window.innerWidth;  
		hauteurResolution = window.innerHeight;  
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {  
		//IE 6+ in 'standards compliant mode'  
		largeurResolution = document.documentElement.clientWidth;  
		hauteurResolution = document.documentElement.clientHeight;  
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {  
		//IE 4 compatible  
		largeurResolution = document.body.clientWidth;  
		hauteurResolution = document.body.clientHeight;  
	}  
	
	xhr.open("POST",'ajax.php',true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send("fonctionAjax=ajaxDeterminerResolutionEcran&largeurResolution="+largeurResolution+"&hauteurResolution="+hauteurResolution);
}

determinerResolutionEcran();
