// JavaScript Document
//
// Recherche les valeurs des paramètres dans une base mySQL via PHP 
//
var myValues;

function PHPBridge()	{
     var xhr_object = null;
     var data     = null;
     var ladate=new Date();

     if(window.XMLHttpRequest){

       ////////// Firefox //////////

       xhr_object = new XMLHttpRequest();

       filename = "php2html.php?i='A" + ladate.getSeconds() + "'";
       xhr_object.open("GET", filename, false);
       xhr_object.send(null);

       if(xhr_object.readyState == 4) {
         myValues = null
         myValues = xhr_object.responseText.split("\n");
       }

     }
     else if(window.ActiveXObject) {

       ////////// Internet Explorer  ///////////

       xhr_object = new ActiveXObject("Microsoft.XMLHTTP");

       filename = "php2html.php?i='A" + ladate.getSeconds() + "'";
       xhr_object.open("GET", filename, false);

       xhr_object.onreadystatechange = function() {
	     if(xhr_object.readyState == 4) {
           myValues = null
           myValues = xhr_object.responseText.split("\n");
	     }
       }
       xhr_object.send(data);

     }
     else {

       ///////// XMLHttpRequest non supporté par le navigateur  ////////

       document.write("?");
       return;

     }

}
PHPBridge ();

function php2html (index){
      if (myValues != null){
        document.write(myValues[index]);
      }
      else{
        document.write("? "+index);
      }
}

