    function GetXmlHttp()
    {
        var x = null;
        try
        {
            x = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                x = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                x = null;
            }            
        }
        
        if (!x && typeof XMLHttpRequest != "undefined")
        {
            x = new XMLHttpRequest();            
        }

        return x;
    }
    
    function DisplayQueryResults(element, htmlResult) {
		if (document.getElementById("divWait") != null) {
		    document.getElementById("divWait").style.display = 'none';
		}
		document.getElementById(element).innerHTML = '';
		document.getElementById(element).innerHTML = (htmlResult);
        document.getElementById(element).style.display='block';
	}

    function ajaxGetPollInfo(element,pagename)
   {
        //Update the message area to give the user a status.
        //document.getElementById(element).innerHTML = "" //&nbsp;&nbsp;Beginning search...please wait";
        //document.getElementById(element).innerHTML = "Looking up...";

        //Built the url to call the server
		var url = pagename;
		
		//prevent cache of request
		var bustcacheparameter
		bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
		
        url = url+bustcacheparameter;

        //Start by getting the appropriate XMLHTTP object for the browser
        var xmlhttp = GetXmlHttp();
        
        //If we have a valid xmlhttp object
        if (xmlhttp)
        {
            xmlhttp.open("GET", url, true);  // varAsync = true;

            //Set the callback.  This function is called when we 
            xmlhttp.onreadystatechange = function()
            {
		if (xmlhttp.readyState == 4)  //4 is a success
                {
                    //Server code creates javascript "on the fly" for us to
                    //execute using eval()
                    var result = xmlhttp.responseText;
                    //alert(result);
                    eval(result);
                    //hide the ajax wait image when finished processing
                    hidewaitimage(element);

                }
            }
            
            xmlhttp.send(null);
        }
    }
	
    function hidewaitimage(element)
        {
            if (document.getElementById(element.replace('div', 'img')) != null)
                {
                     document.getElementById(element.replace('div', 'img')).style.display='none';
                }

        }

    function showwaitimage(element)
        {
            if (document.getElementById(element.replace('div', 'img')) != null)
                {
                     document.getElementById(element.replace('div', 'img')).style.display='block';
                }

        }
