function GetXmlHttpObject(handler)
{
   var objXMLHttp=null
   if (window.XMLHttpRequest)
   {
       objXMLHttp=new XMLHttpRequest()
   }
   else if (window.ActiveXObject)
   {
       objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
   }
   return objXMLHttp
}
/*
 * v2
 */
function getXMLHTTP() {
  var xmlhttp = false;
  try {
    xmlhttp = new XMLHttpRequest();
  } catch(e) {
    try { 
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e){
      try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
      } catch(e1) {
        xmlhttp = false;
        }
      }
    }
  return xmlhttp;
}
/*
 * v3 d'apres jQuery
 */
function get_XMLHTTP_Request_Object() {
  return window.ActiveXObject ?
    new ActiveXObject("Microsoft.XMLHTTP") :
    new XMLHttpRequest();
}

/*
function stateChanged()
{

  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
         document.getElementById("sdiv").innerHTML= xmlHttp.responseText;
   }
   else {
           //alert(xmlHttp.status);
   }
}
*/

// Will populate data based on input
/*function htmlData(url, qStr)*/
function htmlData(url, qStr, oid) {
  if (url.length==0)
    return;

  /*xmlHttp = GetXmlHttpObject();*/
  xmlHttp = get_XMLHTTP_Request_Object();
  if (xmlHttp == null) {
    alert ("Votre navigateur ne supporte pas HTTP Request");
    return;
  }

  url=url+"?"+qStr;
  url=url+"&rand="+Math.random();
/*  xmlHttp.onreadystatechange=stateChanged;*/
  xmlHttp.onreadystatechange = function() {
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
      document.getElementById(oid).innerHTML= xmlHttp.responseText;
      switch(oid) {
        case 'sdiv':
          document.getElementById('ddiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('icdiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdiv').innerHTML="<select><option>...</option></select>";
        break;
        case 'cdiv':
          document.getElementById('ddiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('icdiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdiv').innerHTML="<select><option>...</option></select>";
        break;
        case 'ddiv':
          document.getElementById('icdiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdiv').innerHTML="<select><option>...</option></select>";
        break;
        case 'ivdiv' :
          document.getElementById('icdiv').innerHTML="<select><option>...</option></select>";
        break;


        case 'sdivutil':
          document.getElementById('ddivutil').innerHTML="<select><option>...</option></select>";
          document.getElementById('icdivutil').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdivutil').innerHTML="<select><option>...</option></select>";
        break;
        case 'cdivutil':
          document.getElementById('ddivutil').innerHTML="<select><option>...</option></select>";
          document.getElementById('icdivutil').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdivutil').innerHTML="<select><option>...</option></select>";
        break;
        case 'ddivutil':
          document.getElementById('icdivutil').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdivutil').innerHTML="<select><option>...</option></select>";
        break;
        case 'ivdivutil' :
          document.getElementById('icdivutil').innerHTML="<select><option>...</option></select>";
        break;


        case 'sdiv44':
          document.getElementById('ddiv44').innerHTML="<select><option>...</option></select>";
          document.getElementById('icdiv44').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdiv44').innerHTML="<select><option>...</option></select>";
        break;
        case 'cdiv44':
          document.getElementById('ddiv44').innerHTML="<select><option>...</option></select>";
          document.getElementById('icdiv44').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdiv44').innerHTML="<select><option>...</option></select>";
        break;
        case 'ddiv44':
          document.getElementById('icdiv44').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdiv44').innerHTML="<select><option>...</option></select>";
        break;
        case 'ivdiv44' :
          document.getElementById('icdiv44').innerHTML="<select><option>...</option></select>";
        break;


        case 'sdivPL':
          document.getElementById('ddivPL').innerHTML="<select><option>...</option></select>";
          document.getElementById('icdivPL').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdivPL').innerHTML="<select><option>...</option></select>";
        break;
        case 'cdivPL':
          document.getElementById('ddivPL').innerHTML="<select><option>...</option></select>";
          document.getElementById('icdivPL').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdivPL').innerHTML="<select><option>...</option></select>";
        break;
        case 'ddivPL':
          document.getElementById('icdivPL').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdivPL').innerHTML="<select><option>...</option></select>";
        break;
        case 'ivdivPL' :
          document.getElementById('icdivPL').innerHTML="<select><option>...</option></select>";
        break;

        case 'sdivAG':
          document.getElementById('ddivAG').innerHTML="<select><option>...</option></select>";
          document.getElementById('icdivAG').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdivAG').innerHTML="<select><option>...</option></select>";
        break;
        case 'cdivAG':
          document.getElementById('ddivAG').innerHTML="<select><option>...</option></select>";
          document.getElementById('icdivAG').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdivAG').innerHTML="<select><option>...</option></select>";
        break;
        case 'ddivAG':
          document.getElementById('icdivAG').innerHTML="<select><option>...</option></select>";
          document.getElementById('ivdivAG').innerHTML="<select><option>...</option></select>";
        break;
        case 'ivdivAG' :
          document.getElementById('icdivAG').innerHTML="<select><option>...</option></select>";
        break;

        // search
        case 's_ldiv':
          document.getElementById('s_sdiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('s_ddiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('s_icdiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('s_ivdiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('search_button').className="bko";
          document.getElementById('search_button').disabled=true;
        break;
        case 's_sdiv':
          document.getElementById('s_ddiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('s_icdiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('s_ivdiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('search_button').className="bok";
          document.getElementById('search_button').disabled=false;
          break;
        /*
        case 's_cdiv':
          document.getElementById('s_ddiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('s_icdiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('s_ivdiv').innerHTML="<select><option>...</option></select>";
        break;
        */
        case 's_ddiv':
          document.getElementById('s_icdiv').innerHTML="<select><option>...</option></select>";
          document.getElementById('s_ivdiv').innerHTML="<select><option>...</option></select>";
        break;
        case 's_ivdiv':
          document.getElementById('s_icdiv').innerHTML="<select><option>...</option></select>";
        break;
      }
  };

   xmlHttp.open("GET",url,true) ;
   xmlHttp.send(null);
}
