// JavaScript Document
function add_marque1(ids,names){
 document.calcule.id_marque.value=ids;
 document.calcule.marque.value=names;
 document.getElementById("sug_marque").style.display='none';
 
	document.getElementById("div_prod").innerHTML='';
	document.getElementById("div_prod").style.display='';

 var xmlHttp=Inint_AJAX();
 
	xmlHttp.onreadystatechange = function () {
	
		// data returned from server
		if(xmlHttp.readyState == 4) {
			 if (xmlHttp.status==200) {
			// fill div with server-generated <select>element
			   document.getElementById("div_prod").innerHTML =xmlHttp.responseText;
			   //document.getElementById("img_back").innerHTML='';
			 }
		}		
 }
 	xmlHttp.open("GET", "get-produit1.php?q=" + ids, true);
	xmlHttp.send(null);
	//document.getElementById("imgback").innerHTML='';

 return;

}
//////////////////////////////////////////
function add_marchand(names1){
 document.form_recherche.mots.value=names1;
 document.getElementById("sug_marchands").style.display='none';
 

}
////////////////////////////////////////////
function request(page) {

 var xmlHttp=Inint_AJAX();
 var url="data.php?produit=" + page ;
 
 document.getElementById("content_result").innerHTML='';
 document.getElementById("content_result").style.display='';
 if(page){
  xmlHttp.onreadystatechange = function () {
 // data returned from server
	if(xmlHttp.readyState == 4) {
	  if (xmlHttp.status==200) {
		 //document.getElementById("imgback").innerHTML='<img src="images/result.png" style="border:none">';
		 document.getElementById("content_result").innerHTML =xmlHttp.responseText;
		 
		
		 
	  }
       }else{
         document.getElementById("content_result").innerHTML ='<div id="recherche_profil" style="text-align:center"><img src="images/ajax-loader.gif" style="border:none"></div>';
		 
       }
   }

	xmlHttp.open("GET", url, true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
	xmlHttp.send(null);
}else{
document.getElementById("content_result").style.display='none';
}
document.getElementById("imgback").innerHTML='<img src="images/result.png" style="border:none">';
   return;
}
/////////////////////////////////////////////
function request_page(page){

var k=document.frm_search.keyword.value;
var spec=document.frm_search.spec.value;
var owner=document.frm_search.owner.value;

   var xmlHttp=Inint_AJAX();
  var url="data-pub.php?page=" + page +"&keyword="+k+"&spec="+spec+"&owner="+owner;
  xmlHttp.onreadystatechange = function () {
  if(xmlHttp.readyState == 4) {
     if (xmlHttp.status==200) {
        document.getElementById("content_result").innerHTML =xmlHttp.responseText;
     }
  }else{
     document.getElementById("content_result").innerHTML ='<div id="recherche_profil" style="text-align:center"><img src="images/ajax-loader.gif" style="border:none"></div>';
  }
}
  xmlHttp.open("GET", url, true);
  xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
  xmlHttp.send(null);
  return;
}
/////////////////////////////////////////////
function searchNameq(){
	//var xmlHttp;
	document.getElementById("sug_marchands").innerHTML='';
	document.getElementById("sug_marchands").style.display='';
	document.getElementById("sug_marchands").style.width='263px';
	document.getElementById("sug_marchands").style.background='#fff';
	
	var marchand = document.getElementById("mots");
	var t=marchand.value;
    var xmlHttp=Inint_AJAX();	
	// ajax actions

if(t.length >0){
	xmlHttp.onreadystatechange = function () {
	
		// data returned from server
		if(xmlHttp.readyState == 4) {
			 if (xmlHttp.status==200) {
			// fill div with server-generated <select>element
			   document.getElementById("sug_marchands").innerHTML =xmlHttp.responseText;
			   document.getElementById("sug_marchands").style.border="1px solid #66BD30";
			 }
		}		
	}
	
	// request counties from web server
	xmlHttp.open("GET", "get-marchands.php?q=" + t, true);
	xmlHttp.send(null);
}else{
document.getElementById("sug_marchands").style.display='none';
}
 return;
}
/////////////////////////////
/////////////////////////////////////////////
function searchNameq1(){
	//var xmlHttp;
	document.getElementById("sug_marque").innerHTML='';
	document.getElementById("sug_marque").style.display='';
	var marque = document.getElementById("marque");
	var t=marque.value;
    var xmlHttp=Inint_AJAX();	
	// ajax actions

if(t.length >0){
	xmlHttp.onreadystatechange = function () {
	
		// data returned from server
		if(xmlHttp.readyState == 4) {
			 if (xmlHttp.status==200) {
			// fill div with server-generated <select>element
			   document.getElementById("sug_marque").innerHTML =xmlHttp.responseText;
			   document.getElementById("sug_marque").style.border="1px solid #999";
			 }
		}		
	}
	
	// request counties from web server
	xmlHttp.open("GET", "get-marque1.php?q=" + t, true);
	xmlHttp.send(null);
}else{
document.getElementById("sug_marque").style.display='none';
}
 return;
}
////////////////////////||| Ajax Search
////////////////////////||| Ajax Search
function Ajaxsearch(){

//var xmlHttp;
	var patientList = document.getElementById("patientList");
	//var ville= frmsearch.ville.value;
	//var type1= frmsearch.type.value;
    var xmlHttp1=Inint_AJAX();	
	// ajax actions
			
	xmlHttp1.onreadystatechange = function () {
	alert(xmlHttp1.readyState);
		// data returned from server
		if(xmlHttp1.readyState == 4) {
			 if (xmlHttp1.status==200) {
			// fill div with server-generated <select>element
			   document.getElementById("resltList").innerHTML =xmlHttp1.responseText;
			 }
		}		
	}
	
	// request counties from web server
	//var lien=";
	//alert(lien);
	xmlHttp1.open("GET", "search-adresses.php?dept=" + deptList.options[deptList.selectedIndex].value + "&ville=" + ville + "&type=" + type1, true);
	//xmlHttp.send(null);

}
///////////////////////////////////////////////////////
function Inint_AJAX() {
   try { return new ActiveXObject("Msxml2.XMLHTTP");  } catch(e) {} //IE
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE
   try { return new XMLHttpRequest();          } catch(e) {} //Native Javascript
   alert("XMLHttpRequest not supported");
   return null;
};

