
// ##########  Основные переменные #############

var ajaxUrl = 'http://www.budgetrf.ru/openDB/ajax/ajax.php';
var ajaxReq;

// ##########  Основные функции ################

function loadXMLDoc(url) 
{
// alert(url);
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        ajaxReq = new XMLHttpRequest();
        ajaxReq.onreadystatechange = ajaxProcessResponse;
        ajaxReq.open("GET", url, true);
        ajaxReq.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
        if (ajaxReq) {
            ajaxReq.onreadystatechange = ajaxProcessResponse;
            ajaxReq.open("GET", url, true);
            ajaxReq.send();
        }
    }
}

function ajaxProcessResponse() 
{
    if (ajaxReq.readyState == 4) {
        if (ajaxReq.status == 200) {
// alert(ajaxReq.responseText);
            ajaxResponse  = ajaxReq.responseXML.documentElement;
            ajaxMethodsList = ajaxResponse.getElementsByTagName("method");
            for (var i=0; i<ajaxMethodsList.length; i++) {
                ajaxMethodName = ajaxMethodsList[i].getAttribute("name");
                eval(ajaxMethodName + '(ajaxMethodsList[i])');
            }
        } else {
            alert("There was a problem retrieving the XML data:\n" + ajaxReq.statusText);
        }
    }
}

function noMethod() {
}

