/* window.onload = function()
 {
 alert("on loade");
    //on associe la fonction verifId à
    //l'événénement onsubmit du formulaire
    //document.getElementById('frmIdentification').onsubmit = verifId;

 } */
function on_load(id_log) {
	verif_definition(id_log);
} 
 function getHTTPObject()
{
 //alert("on getHTTPObject");
  var xmlhttp = false;

  /* Compilation conditionnelle d'IE */
  /*@cc_on
  @if (@_jscript_version >= 5)
     try
     {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
     }
     catch (e)
     {
        try
        {
           xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (E)
        {
           xmlhttp = false;
        }
     }
  @else
     xmlhttp = false;
  @end @*/
//alert(xmlhttp+"es tl objet xmlhttp");
  /* on essaie de créer l'objet si ce n'est pas déjà fait */
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
  {
     try
     {
        xmlhttp = new XMLHttpRequest();
     }
     catch (e)
     {
        xmlhttp = false;
     }
  }
//alert(xmlhttp+"es tl objet xmlhttp");

  if (xmlhttp)
  {
     /* on définit ce qui doit se passer quand la page répondra */
     xmlhttp.onreadystatechange=function()
     {
//alert(xmlhttp.readyState+"es tl objet xmlhttp");
        if (xmlhttp.readyState == 4) /* 4 : état "complete" */
        {
           if (xmlhttp.status == 200) /* 200 : code HTTP pour OK */
           {
              /*
              Traitement de la réponse.
              Ici on affiche la réponse dans une boîte de dialogue.
              */
        // alert(xmlhttp.responseText);
			  
//eval(xmlhttp.responseText);

var c = document.getElementById('div_id_bis');
   //document.getElementById('div_id_bis').innerHTML ='';
//alert('on va vider le div_id_bis enfin je vuex, quand on voit que on l a choppe');
    c.innerHTML = xmlhttp.responseText;
    //maintenant que les données reçues on été placé dans la page,
    //il faut exécuter toutes les balise script :
    var allscript = c.getElementsByTagName('script');
	//alert (allscript.length+' est le aull script');
    for(var i=0;i<allscript.length;i++){
	//alert (allscript[i]+' est le aull script');
      eval(allscript[i].text);
    }

	
	
	
	
	
    //alert(typeof(une_function_dans_mes_balise_script));//return function
//alert('on va vider le div_id_bis enfin je vuex');
  // document.getElementById('div_id_bis').innerHTML ='';
			  document.getElementById('div_id_bis').style.visibility='visible';
			  document.getElementById('div_id_bis').style.display='block';
			  document.getElementById('div_id_bis').innerHTML =xmlhttp.responseText;
           			  document.getElementById('div_id_load').style.visibility='hidden';
			  document.getElementById('div_id_load').style.display='none';
		   }
        }
     }
  }
  return xmlhttp;
}

function verifleId(nb_produits_total)
 {
  //  document.getElementById('div_id_bis').innerHTML ='';
//alert('on va vider le div_id_bis enfin je vuex, quand on voit que on l a choppe des le debut de la fonction');
 			  //document.getElementById('div_id_load').style.visibility='visible';
			  //document.getElementById('div_id_load').style.display='block';
var alerte=nb_produits_total;
//alert(nb_produits_total+' <= c est l alerte');
    //envoi des données
  url_du_send_data='hit='+document.form_hit.hit.value; 
	  
//alert(url_du_send_data+' <= c est l alerteurl_du_send_data');
	return !sendData(
       'POST',
       'jax_vis.php',
       'xmlhttp=1&'+
url_du_send_data);	   
	   
//alert(' pas est l alerte');
 }
function verif_definition(id_log)
 {
  //  document.getElementById('div_id_bis').innerHTML ='';
//alert('on va vider le div_id_bis enfin je vuex, quand on voit que on l a choppe des le debut de la fonction');
 			  //document.getElementById('div_id_load').style.visibility='visible';
			  //document.getElementById('div_id_load').style.display='block';
var alerte=id_log;
	if (document.body)
{
var larg = (document.body.clientWidth);
var haut = (document.body.clientHeight);
} 
 //alert(id_log+' <= c est l alerte, le width du body =>'+document.body.clientWidth+"& le height du body "+document.body.clientHeight);
//alert(id_log+' <= c est l alerte, le width =>'+screen.width+"& le height"+screen.height+"& le window height "+window.innerHeight+"& le window width "+window.innerWidth); 
    //envoi des données
  url_du_send_data='hit='+id_log+'&largeur='+screen.width+"&hauteur="+screen.height; 
 
//alert(url_du_send_data+' <= c est l alerteurl_du_send_data');
	return !sendData(
       'GET',
       'jax_definition.php',
       'xmlhttp=1&'+
url_du_send_data);	   
	   
//alert(' pas est l alerte');
 }
/**
  * Envoie des données à l'aide d'XmlHttpRequest?
  * @param string methode d'envoi ['GET'|'POST']
  * @param string url
  * @param string données à envoyer sous la forme var1=value1&var2=value2...
  */
 function sendData(method, url, data)
 {
    var xmlhttp = getHTTPObject();

    if (!xmlhttp)
    {
        return false;
    }
//alert("la méthode est "+method);
    if(method == "GET")
     {
     if(data == 'null')
     {
            xmlhttp.open("GET", url, true); //ouverture asynchrone
     }
     else
     {
            xmlhttp.open("GET", url+"?"+data, true);
     }
        xmlhttp.send(null);
     }
     else if(method == "POST")
     {
        xmlhttp.open("POST", url, true); //ouverture asynchrone
        xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
     xmlhttp.send(data);
     }
    return true;
 }



