// Globals

var TaskId = 0;

var ButtonsDiv = undefined;

// End globals

    if(!Array.indexOf){
        Array.prototype.indexOf = function(obj){
            for(var i=0; i<this.length; i++){
                if(this[i]==obj){
                    return i;
                }
            }
            return -1;
        }
    }

function MakeEmptyXMLDoc()
{
    if (document.implementation && document.implementation.createDocument)
    {
        return document.implementation.createDocument('', '', null);
    }
    else
    {
        return new ActiveXObject('MSXML2.DOMDocument');
    }
}

function ProcessAjax(config)
{
    var url = config.url;
    var callback = config.callback;
    var beforeSend = config.beforeSend;
    
    var xmlDoc = MakeEmptyXMLDoc();
    if (document.implementation && document.implementation.createDocument)
    {
        xmlDoc.onload = function() {callback(xmlDoc);};
    }
    else
    {
        xmlDoc.onreadystatechange = function() {
            if (xmlDoc.readyState==4) {
                callback(xmlDoc);
            }
        }
    }
    
    if( beforeSend != undefined )
    {
        beforeSend();
    }
    xmlDoc.load(url);
}