    var xmlHttp;

    var fnCallback;

    var dojoDndTargetID;
    
    function CreateXMLDocument(rootTagName, namespaceURL) {   
        if (!rootTagName) rootTagName = "";   
        if (!namespaceURL) namespaceURL = "";   
        if (document.implementation && document.implementation.createDocument) {   
          // This is the W3C standard way to do it
            return document.implementation.createDocument(namespaceURL, rootTagName, null);
        }   
        else { // This is the IE way to do it   
          // Create an empty document as an ActiveX object   
          // If there is no root element, this is all we have to do   
          var doc = new ActiveXObject("MSXML2.DOMDocument");   
          // If there is a root tag, initialize the document   
          if (rootTagName) {   
            // Look for a namespace prefix   
            var prefix = "";   
            var tagname = rootTagName;   
            var p = rootTagName.indexOf(':');   
            if (p != -1) {   
              prefix = rootTagName.substring(0, p);   
              tagname = rootTagName.substring(p+1);   
            }   
            // If we have a namespace, we must have a namespace prefix   
            // If we don't have a namespace, we discard any prefix   
            if (namespaceURL) {   
              if (!prefix) prefix = "a0"; // What Firefox uses   
            }   
            else prefix = "";   
            // Create the root element (with optional namespace) as a   
            // string of text   
            var text = "<" + (prefix?(prefix+":"):"") +  tagname +   
                (namespaceURL   
                 ?(" xmlns:" + prefix + '="' + namespaceURL +'"')   
                 :"") +   
                "/>";   
            // And parse that text into the empty document   
            doc.loadXML(text);   
          }   
          return doc;   
        }
    }

	function createXMLHttpRequest() {
        if (window.ActiveXObject) {
             xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
        }
        else if (window.XMLHttpRequest) {
             xmlHttp = new XMLHttpRequest();
        }
    }

    //openMethod is either 'Post' or 'Get'
    //fnCallbackMethod is assigned to fnCallback which is the Javascript function that
    //will be called when the Ajax request has been processed on the server and
    //returns the responseText.
    function ProcessAjaxRequest(fnCallbackMethod, openMethod, URL) {
        createXMLHttpRequest();
        fnCallback = fnCallbackMethod;
        xmlHttp.onreadystatechange = ProcessAjaxCallback;
        xmlHttp.open(openMethod, URL, true);
        xmlHttp.send(null);
    }

    function ProcessAjaxCallback() {
        if (xmlHttp.readyState == 4) {
            if (xmlHttp.status == 200) {
                fnCallback(xmlHttp.responseText);
            }
            else {
                alert("Unsuccessful Ajax Callback");
            }
        }
    }
    
    function ExecuteSearchFilter(filePath, processingMethod, filterType, strSearch) {
           createXMLHttpRequest();
           xmlHttp.onreadystatechange = processingMethod;
           xmlHttp.open('Post',filePath + '?filterType=' + filterType + '&searchText=' + strSearch,true);
           xmlHttp.send(null);
    }
    
    function ExecuteCommand(filePath, processingMethod, commandName, commandValue) {
           createXMLHttpRequest();
           xmlHttp.onreadystatechange = processingMethod;
           xmlHttp.open('Post',filePath + '?command=' + commandName + '&value=' + commandValue,true);
           xmlHttp.send(null);
       }

       function FindInnerElementByID(objDoc, strTagName, strID) {
           var objTag = null;
           var objInnerTag;
           var i;

           var objTags = objDoc.getElementsByTagName(strTagName);
           for (i = 0; i < objTags.length; i++) {
               objInnerTag = objTags[i];
               if (objInnerTag.getAttribute("id") == strID) {
                   objTag = objInnerTag;
                   break;
               }
           }
           if (objTag == null) {
               for (i = 0; i < objDoc.childNodes.length; i++) {
                   objTag = FindInnerElementByID(objDoc.childNodes[i], strTagName, strID);
                   if (objTag != null) {
                       break;
                   }
               }
           }
           return objTag;
       }

       function FindInnerElementByAtt(objDoc, strTagName, strAttName, strAttValue) {
           var objTag = null;
           var objInnerTag;
           var i;

           var objTags = objDoc.getElementsByTagName(strTagName);
           for (i = 0; i < objTags.length; i++) {
               objInnerTag = objTags[i];
               if (objInnerTag.getAttribute(strAttName) == strAttValue) {
                   objTag = objInnerTag;
                   break;
               }
           }
           if (objTag == null) {
               for (i = 0; i < objDoc.childNodes.length; i++) {
                   objTag = FindInnerElementByAtt(objDoc.childNodes[i], strTagName, strAttName, strAttValue);
                   if (objTag != null) {
                       break;
                   }
               }
           }
           return objTag;
       }


       function GetXmlDocumentAsString(xmlDoc) {
           var xmlString = "unknown";

           if (document.implementation && document.implementation.createDocument) {
               var serializer = new XMLSerializer();
               xmlString = serializer.serializeToString(xmlDoc);
           }
           else {
               xmlString = xmlDoc.xml;
           }

           return xmlString;
       }
