        var isIE = false;
	

        // global request and XML document objects
        var req;

        //////////////////////////////////////////////////////////
        // AJAX XML file loader
        //////////////////////////////////////////////////////////
        function loadPluginDoc(url, dir)
        {
            //  alter url to prevent caching
            
           
	    var urlstr = "&RANDOM=" + (Math.random() * Date.parse(new Date()));

            //url = '/includes/ajax/' + url + urlstr;
	    //url = '/kcm/admin/includes/ajax/' + url + urlstr;
	    url = dir + url + urlstr;

            // branch for native XMLHttpRequest object
            if (window.XMLHttpRequest)
            {
                req = new XMLHttpRequest();
                req.onreadystatechange = processReqChange;
                req.open("GET", url, true);
                req.send(null);

                // branch for IE/Windows ActiveX version
            }
            else if (window.ActiveXObject)
            {
                isIE = true;
                req = new ActiveXObject("Microsoft.XMLHTTP");

                if (req)
                {
                    req.onreadystatechange = processReqChange;
                    req.open("GET", url, true);
                    req.send();
                }
            }
        }
   
        function loadPluginDocPost(url, dir, params)
        {
            //  alter url to prevent caching         
        
	    url = dir + url;

            // branch for native XMLHttpRequest object
            if (window.XMLHttpRequest)
            {
                
                req = new XMLHttpRequest();
                req.onreadystatechange = processReqChange;
                req.open("POST", url, true);
                
                req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                req.send(params);

                // branch for IE/Windows ActiveX version
            }
            else if (window.ActiveXObject)
            {
                isIE = true;
                req = new ActiveXObject("Microsoft.XMLHTTP");

                if (req)
                {
                    req.onreadystatechange = processReqChange;
                    req.open("POST", url, true);
                    req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                    req.send(params);
                }
            }
        }   
        
        function loadDoc(url)
        {
            //  alter url to prevent caching
            
           
	    var urlstr = "&RANDOM=" + (Math.random() * Date.parse(new Date()));

            //url = '/includes/ajax/' + url + urlstr;
	    url = '/kcm/admin/includes/ajax/' + url + urlstr;

            // branch for native XMLHttpRequest object
            if (window.XMLHttpRequest)
            {
                req = new XMLHttpRequest();
                req.onreadystatechange = processReqChange;
                req.open("GET", url, true);
                req.send(null);

                // branch for IE/Windows ActiveX version
            }
            else if (window.ActiveXObject)
            {
                isIE = true;
                req = new ActiveXObject("Microsoft.XMLHTTP");

                if (req)
                {
                    req.onreadystatechange = processReqChange;
                    req.open("GET", url, true);
                    req.send();
                }
            }
        }
        //////////////////////////////////////////////////////////
        // handle onreadystatechange event of req object
        //////////////////////////////////////////////////////////

        function processReqChange()
        {
            //document.getElementById('xmlStatus').innerHTML = req.readyState;

            // only if req shows "loaded"
            if (req.readyState == 4)
            {
                // only if "OK"
                if (req.status == 200)
                {
                    // loaded the XML document
                    
                    returnFunction();
                 }
                 else
                 {
                    alert("There was a problem retrieving the XML data:\n" + req.statusText);
                 }
            }
        }

