/**
 * @constructor
 * Construit un nouvel objet XmlHttpReq.
 *
 * @class Appels asynchrone d'un serveur.
 * <br><i>Compatibilité: (IE5+, FireFox 1.0+, Opera7.46+).</i>
 *
 * @return un nouveau XmlHttpReq
 *
 * @author Maurice Montgénie (maurice.montgenie@cgss-guyane.fr)
 * @version $Revision: 1.1 $ $Date: 2005/01/06 12:59:12 $
 */
function XmlHttpReq() {
    /*@cc_on @*/
    /*@if (@_jscript_version >= 5)
        // JScript gives us Conditional compilation, we can cope with old IE versions.
        // and security blocked creation of the objects.
        try {
            XmlHttpReq.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                XmlHttpReq.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
            }
        }
    @end @*/

    if (!XmlHttpReq.xmlhttp && typeof XMLHttpRequest!='undefined') {
        try {
            XmlHttpReq.xmlhttp = new XMLHttpRequest();
        } catch (e) {
        }
    }
}

 /**
  * Exécutes d'une requête.
  *
  * @param {String} url l'url d'appel du serveur
  * @param {Function} callback la fonction appelée lors de la réception de la réponse
  */
XmlHttpReq.prototype.executer = function(url, callback) {
    XmlHttpReq.xmlhttp.open("GET", url, true);

    XmlHttpReq.xmlhttp.onreadystatechange=function() {
        if (XmlHttpReq.xmlhttp.readyState==4) {
            callback();
        }
     };

    XmlHttpReq.xmlhttp.send(null);
}

/**
 * Renvoie la réponse du serveur.
 *
 * @return la réponse du serveur
 * @type String
 */
XmlHttpReq.prototype.getReponse = function() {
    return XmlHttpReq.xmlhttp.responseText;
}

/**
 * L'objet XMLHTTP (ie) ou XmlHttpRequest (moz) sous-jacent.
 *
 * @type XmlHttpRequest
 * @private
 */
XmlHttpReq.xmlhttp = false;