// SetInnerHTML Sécurisé
function setInnerHTML(divContent, HTML) {
  divContent.innerHTML=HTML;
  var All=divContent.getElementsByTagName("*");
  for (var i=0; i<All.length; i++) {
    All[i].id=All[i].getAttribute("id")
    All[i].name=All[i].getAttribute("name")
    All[i].className=All[i].getAttribute("class")
  }
  var AllScripts=divContent.getElementsByTagName("script")
  for (var i=0; i<AllScripts.length; i++) {
     var s=AllScripts[i];
     if (s.src && s.src!="") {
        // Précédement asynchrone, mis en synchrone pour éviter des problèmes de dépendances de scripts
        eval(getFileContent(s.src))
     }
     else {
        eval(s.innerHTML)
     }
  }
}

// Renvoie le texte de l'objet ActiveXObject le plus récent depuis une liste
var 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 ("Aucun ActiveXObject n'est valide sur votre ordinateur, pensez à mettre à jour votre navigateur");
    idList = null;
    return o2Store;
}

// Retourne un nouvel objet XmlHttpRequest
var GetXmlHttpRequest_AXO=null
var 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;
}

function getFileContent(url) {
   var Xhr=GetXmlHttpRequest();
   Xhr.open("GET",url,false);
   Xhr.send(null);
   return Xhr.responseText;
}
