
function sendData(data, page, method)
{
    if(window.ActiveXObject)
    {
        //Internet Explorer
        var XhrObj = new ActiveXObject("Microsoft.XMLHTTP") ;
    }//fin if
    else
    {
        //Mozilla
        var XhrObj = new XMLHttpRequest();
    }//fin else
    
    //définition de l'endroit d'affichage:
    var content = document.getElementById("zoneResultats");
    
    //si on envoie par la méthode GET:
    if(method == "GET")
    {
        if(data == 'null')
        {
            //Ouverture du fichier sélectionné:
            XhrObj.open("GET", page);
        }//fin if
        else
        {
            //Ouverture du fichier en methode GET
            XhrObj.open("GET", page+"?"+data);
        }//fin else
    }//fin if
    else if(method == "POST")
    {
        //Ouverture du fichier en methode POST
        XhrObj.open("POST", page);
    }//fin elseif

    //Ok pour la page cible
    XhrObj.onreadystatechange = function()
    {
        if (XhrObj.readyState == 4 && XhrObj.status == 200){
        	if (XhrObj.responseText==''){
        		window.document.getElementById('zoneResultats').innerHTML = '';
          window.document.getElementById('zoneResultats').style.visibility = 'hidden';	
        		
        		
        	}
        		
        
            content.innerHTML = XhrObj.responseText ;
          }
    }    

    if(method == "GET")
    {
        XhrObj.send(null);
    }//fin if
    else if(method == "POST")
    {
        XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
        
        	
        XhrObj.send(data);
    }//fin elseif
}//fin fonction SendData

function loadData(type) 
{
	

               if (window.document.getElementById('search_dc').value.length > 0) {
               	
               	
               	window.document.getElementById('zoneResultats').style.visibility = 'visible';	
               
               	

                    sendData('search_dc='+ window.document.getElementById('search_dc').value, 'search2.php?type='+type, 'POST');
               }
               else {
                    window.document.getElementById('zoneResultats').innerHTML = '';
                    window.document.getElementById('zoneResultats').style.visibility = 'hidden';
               }
}

function cache_result_search() {
	
	  window.document.getElementById('zoneResultats').style.visibility = 'hidden';
}

