function getValue(str)
{
    var val=document.getElementById(str).firstChild.firstChild.innerHTML;
    document.getElementById("search_text").value="";
    document.getElementById("search_text").value=val;
    document.getElementById("disp").innerHTML="";
}


function getXMLObject() //XML OBJECT
{
    var xmlHttp = false;
    try {
        xmlHttp = new ActiveXObject("Msxml2.XMLHTTP") // For Old Microsoft Browsers
    }  
    catch (e) {
         try 
         {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP") // For Microsoft IE 6.0+
         }
        catch (e2) {
        xmlHttp = false // No Browser accepts the XMLHTTP Object then false
        }
    }
    if (!xmlHttp && typeof XMLHttpRequest != 'undefined') 
    {
        xmlHttp = new XMLHttpRequest(); //For Mozilla, Opera Browsers
    }
    return xmlHttp; // Mandatory Statement returning the ajax object created
}

var xmlhttp = new getXMLObject();	//xmlhttp holds the ajax object
document.getElementsByTagName("body")[0].onclick=function(){document.getElementById('disp').innerHTML="";};
function ajaxFunction() 
{
    //var getdate = new Date(); //Used to prevent caching during ajax call
    if(document.getElementById("search_text").value.length >2)
    {
        if(xmlhttp) { 
            xmlhttp.open("GET","AjaxCall.aspx?search_text=" + document.getElementById("search_text").value); //gettime will be the servlet name
            xmlhttp.onreadystatechange = handleServerResponse;
            xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            xmlhttp.send();
        }
    }
    else
    {
        document.getElementById("disp").innerHTML="";
    }
}

function handleServerResponse() 
{
    if (xmlhttp.readyState == 4) {
        if(xmlhttp.status == 200) {
            //document.getElementById("disp").innerHTML=xmlhttp.responseText; //Update the HTML Form element 
            document.getElementById("disp").innerHTML=xmlhttp.responseText;
        }
        
    }
}
