/**
 * Tool for sending an AJAX request with GET parameters for retrieving data.
 */

/* Dedicated HttpRequest object (as global) */
var objGetRequest = null;

/* Main method for retrieving data in the ServerResponseForObtainData callback method */
function ObtainData(url) {
    /* Detect client browser for getting the expected HttpRequest object */
    if (window.XMLHttpRequest)
        objGetRequest = new XMLHttpRequest();
    else if (window.ActiveXObject)
        objGetRequest = new ActiveXObject("Microsoft.XMLHTTP");

    /* Send AJAX form and get response */
    objGetRequest.open('post', url, true);
    objGetRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    objGetRequest.onreadystatechange = ServerResponseForObtainData;

    /* Display loading bar and hide buttons */
    document.getElementById("loading").style.display = '';
    document.getElementById("btZone").style.display = 'none';

    /* Send request and wait for response */
    objGetRequest.send();
}
