
function createXHR() 
{
    var request = false;
        try {
            request = new ActiveXObject('Msxml2.XMLHTTP');
        }
        catch (err2) {
            try {
                request = new ActiveXObject('Microsoft.XMLHTTP');
            }
            catch (err3) {
		try {
			request = new XMLHttpRequest();
		}
		catch (err1) 
		{
			request = false;
		}
            }
        }
    return request;
}

function selecte(id,nom){

document.location.href='/gestion/produit.php?modif='+id+'&modifsel=1';

   }

function rempliproduit()
{ 
    var xhr = createXHR(); 
    xhr.onreadystatechange  = function()
    { 
         if(xhr.readyState  == 4)
         {
              if(xhr.status  == 200) {
              	if(xhr.responseText!=''){
					 document.getElementById("zonerch").style.display = 'block';
					 document.getElementById("zonerch").innerHTML = xhr.responseText;
				}
			}
         }
    }; 
	var rch =document.getElementById("modif2").value;
	if(rch.length>2){
		var script = "/gestion/selproduit.php";   // local script
		xhr.open("POST", script, true);		
		xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xhr.send("rch=" + rch  );
	}
}

function selectCL(id,rch){

document.location.href='/gestion/compte.php?compte='+id+'&rch='+rch;

   }

function rempliclient()
{ 
    var xhr = createXHR(); 
    xhr.onreadystatechange  = function()
    { 
         if(xhr.readyState  == 4)
         {
              if(xhr.status  == 200) {
              	if(xhr.responseText!=''){
					 document.getElementById("zonerch").style.display = 'block';
					 document.getElementById("zonerch").innerHTML = xhr.responseText;
				}
			}
         }
    }; 
	var rch =document.getElementById("client2").value;
	if(rch.length>2){
		var script = "/gestion/selclient.php";   // local script
		xhr.open("POST", script, true);		
		xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xhr.send("rch=" + rch  );
	}
}
function ajoutsel(sel)
{ 
    var xhr = createXHR(); 
    xhr.onreadystatechange  = function()
    { 
         if(xhr.readyState  == 4)
         {
              if(xhr.status  == 200) {
              	if(xhr.responseText!=''){
					 document.getElementById("zoneselection").innerHTML = xhr.responseText;
				}
			}
         }
    }; 
		var script = "/selection.php";   // local script
		xhr.open("POST", script, true);		
		xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xhr.send("fichesel=" + sel  );

}
