var url = "";
var data = "";
var res = "";

function doAppLoad(arg1, arg2) {
   url = arg1;
   data = arg2;

   GetAppData();
}

function GetAppData() {
    try {
        loadXMLDoc();
    } catch(e) {
       alert("GETDATA.JS Error: " + e);
    }
}

function loadXMLDoc() {
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("GET", url, true);
        req.send(null);
    }
    else

    if (window.ActiveXObject) {
        isIE = true;
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange;
            req.open("GET", url, false);
            req.send();
        }
    }
}

function processReqChange() {
   // only if req shows "loaded"
   if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
            printSuccess();
        } else {
            printFailure();
        }
    }
}

function printSuccess() {
    res = req.responseXML;
    document.getElementById(data).innerHTML = "<pre>" + res.getElementsByTagName('Data')[0].firstChild.nodeValue +"</pre>";
}

function printFailure() {
    res = req.responseXML;
    document.getElementById(data).lastChild.nodeValue = 'empty';
}
