
 function $(id) { return document.getElementById(id); }

var xmlhttp;
                             /*  The LogClick() function is executed every time a click is pushed on the PDF version button
                                                         the function executes the following:

                                                           - Calls the GetXmlHttpObject() function to create an XMLHTTP object
                                                           - Defines the URL (filename) to send to the server
                                                           - Adds a parameter (q) to the URL 
                                                             with the content of the input field
                                                           - Adds a random number to prevent the server 
                                                             from using a cached file
                                                           - Each time the readyState property changes, 
                                                             the stateChanged() function will be executed
                                                           - Opens the XMLHTTP object with the given URL
                                                           - Sends an HTTP request to the server
                              */                            
function LogClick(obj)
       {                                 
           xmlhttp=GetXmlHttpObject();
        if(xmlhttp==null)
          {
            alert ("Your browser does not support XMLHTTP!"); return;
          }

       var url="log[obj].php?o="+obj;

           xmlhttp.onreadystatechange=stateChanged;
           xmlhttp.open("GET",url,true);
           xmlhttp.send(null);
       }
                                                          // -----------------------------------------
                                                          //  executes every time the state 
                                                          //    of the XMLHTTP object changes
                                                          // ---------
                                                          //  When the state changes to 4 ("complete"), 
                                                          //   the content of the txtHint placeholder 
                                                          //    is filled with the response text
                                                          // -----------------------------------------
function stateChanged()
       {
            // document.getElementById("TimeNOTIFY").innerHTML=xmlhttp.readyState;

        if(xmlhttp.readyState==4)
          {
            // document.getElementById("TimeNOTIFY").innerHTML=xmlhttp.responseText;
          }
       } 
                                                           // -------- ============== --------- 
                                                           // creating XMLHttpRequest object 
                                                           //           for different browsers
                                                           // -------- ============== ---------
function GetXmlHttpObject()
       {
         if(window.XMLHttpRequest)
           {                          // code for IE7+, Firefox, Chrome, Opera, Safari
        return new XMLHttpRequest();
           }

         if(window.ActiveXObject)
           {                          // code for IE6, IE5
        return new ActiveXObject("Microsoft.XMLHTTP");
           }
        return null;
       }
     
