function elemOk(id) {
gids(id).color="darkblue"
gids(id).backgroundColor="yellow"
}
function elemFail( id ) {
gids(id).color="black"
gids(id).backgroundColor="#ffa0a0"
}
function elemWait( id ) {
gids(id).color="green"
gids(id).backgroundColor="#c0c0c0"
}

function tag_value( xml, tag ) {
if (document.all){return xml.responseXML.getElementsByTagName(tag)[0].text;}
else{ return xml.responseXML.getElementsByTagName(tag)[0].textContent; }
}

function AJAX() {
    this._call = Math.random();
    this._method = "GET";
    this._vars = null;
    if(window.XMLHttpRequest) { // Mozilla, Safari, etc.
        this._request = new XMLHttpRequest();
    } else if (window.ActiveXObject) { // IE
        try {
            this._request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                this._request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                alert('Failed to create');
            }
        }
    }
}

AJAX.prototype.execute = function(url,parser) {
    var xml = this._request;
    this._call++;
    xml.open(this._method, url, true);
    xml.setRequestHeader('Content-Type', 'text/xml');
    var readystate = function() {
        try {
            if((xml.readyState == 4) && (xml.status == 200)) {
                parser(xml);
                xml.onreadystatechange = function(){};
                xml = null;
            }
        } catch(e) {
             //alert(e);
        }
    }
    this._request.onreadystatechange = readystate;
    this._request.send(this._vars);
}

