var _ServiceLocation = "http://oot.cps.udayton.edu/demos/oot/server/ootservice.wsdl";
var _ContentLocation = "http://oot.cps.udayton.edu/demos/oot/content/congress.xml";

var _OOTClient = null;
var _CategoryTotal = null;
var _CategoryCount = null;
var _DestinationURL = null;
var _XHR = null;

var _RootElementIndex = 0;
var _Throbber = new ThrobberControl();
var _XML;

if(typeof ActiveXObject != "undefined")
{
    _RootElementIndex = 1;
}

//Create an XMLHttpRequest object for fetching XML files
try  //Firefox, Safari, IE 7.0+, and Opera 8.0+...who uses Opera?
{
    _XHR = new XMLHttpRequest;
}
catch(Error)  //Somebody's using and old version o IE...shame on them.
{
    try
    {
        _XHR = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch(Error)  //Something went wrong!
    {
        _XHR = false;
        alert("Failed to create an XMLHttpRequest object.\n" +
                Error.message);
    }
}

function ParseXMLString(XMLString)
{
    var XMLParser = null;
    var XMLDoc = null;

    try
    {
        XMLParser = new DOMParser();
        XMLDoc = XMLParser.parseFromString(XMLString,"text/xml");
    }
    catch(Error)  //IE is causing trouble
    {
        try
        {
            XMLDoc = new ActiveXObject("Microsoft.XMLDOM");
            XMLDoc.async = false;
            XMLDoc.loadXML(XMLString);
        }
        catch(Error)  //Something went wrong
        {
            XMLdoc = false;
            alert("Error parsing XML:\n" + Error.message);
        }
    }

    return XMLDoc;
}

function ThrobberControl()
{
    var Queue = 0;

    this.Activate = function()
    {
        Queue++;
        document.getElementById("throbber").style.visibility = "visible";

        return;
    }

    this.Deactivate = function()
    {
        if(Queue > 0)
        {
            Queue--;

            if(Queue == 0)
            {
                document.getElementById("throbber").style.visibility = "hidden";
            }
        }

        return;
    }
}
